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: 
renojim
Community Streaming Expert

AsyncPostFromFile() and GetString()

I'm using AsyncPostFromFile to send a command to my server which responds with some xml. The response code is 200 and printing out the headers with GetResponseHeaders() gives the results I expect including a Content-Length of 7845, but GetString() returns an empty string. Any ideas of what the problem could be?

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
2 REPLIES 2
renojim
Community Streaming Expert

Re: AsyncPostFromFile() and GetString()

I'll answer my own question...

It appears there's either a bug in the firmware or the documentation is incorrect. Reading the file into an roByteArray and then using AsyncPostFromString with the roByteArray ToAsciiString() interface works - GetString() returns the response body. When using AsyncPostFromFile, GetString() does not return the response body.

Edit: I could have just used AsyncPostFromString(ReadAsciiFile("pkg:/command.txt")) and skipped the roByteArray.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
RokuKevin
Visitor

Re: AsyncPostFromFile() and GetString()

Thanks for the bug report renojim. I've replicated the issue and we will fix it in an upcoming release.

Your workaround will work for now. In fact all Roku developed channels use AsyncPostFromString() not AsyncPostFromFile() so we never ran into this bug.

--Kevin
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.