Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
KentL
Visitor

AsyncPostFromString response body issue

The AsyncPostFromString function's events will only return the Response body if the HTTP Status Code = 200.

While this probably covers most scenarios, it *should* also return the response body for HTTP Status Code = 201 ("Created"). Currently, it does not. This is actually a pretty big omission since a 201 is a "more correct" response code for certain scenarios.

This one cost me a couple of hours so hopefully it helps someone (and hopefully we can get 201's added for future releases). 😉
0 Kudos
2 REPLIES 2
RokuMarkn
Visitor

Re: AsyncPostFromString response body issue

I haven't tried this, but there is an (apparently undocumented) function RetainBodyOnError in ifUrlTransfer. Try calling xfer.RetainBodyOnError(true) before posting your request. Let me know if this works.

--Mark
0 Kudos
KentL
Visitor

Re: AsyncPostFromString response body issue

Thanks for the suggestion but it didn't work. It didn't raise an error, I just didn't get the response body. Looks like for now I can only return the 200 status. Can we get the 201 status code added for the next release?
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.