You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As sessionId is part of the request URL and the second argument is used for the request Body, it seems that the missing request body causes the problem.
The text was updated successfully, but these errors were encountered:
Hi @jfoshee !
Thanks for the detailed write-up here. Like you mention, it sounds like the issue can be resolved by ensuring the second parameter (the request body) is always passed, even if it’s empty. This is why the working request adds an empty body: new().
In your opinion, do you thinking changing that field to be explicitly required would provide a good resolution?
I think making the parameter required would be the most expedient thing (as the backend requires it).
On a dev-friendly note, because adding the default requestBody adds no additional info or value to the request, I do think adding a convenience override without the parameter would be nice.
If the Speakeasy generator cannot accommodate this directly, C# provides two ways to add convenience implementations to generated code:
extension methods
partial classes
I think with your current design, making the parameter required, and adding this manual code would do the trick:
/// <summary>/// Create a session token/// <remarks>/// Creates a session JSON Web Token (JWT) based on a session./// </remarks>/// </summary>publicstaticTask<CreateSessionTokenResponse>CreateSessionTokenAsync(thisISessionssessions,stringsessionId){// The backend requires a non-empty request bodyreturnsessions.CreateSessionTokenAsync(sessionId,requestBody:new());}
Repro Code
SDKError.Response
Speculation
Note that Sessions.CreateSessionTokenAsync has an optional second parameter for overriding the default expiration.
If we make the request as so, then the request succeeds:
As
sessionId
is part of the request URL and the second argument is used for the request Body, it seems that the missing request body causes the problem.The text was updated successfully, but these errors were encountered: