Forum Discussion

renojim's avatar
renojim
Community Streaming Expert
15 years ago

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

2 Replies

  • 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
  • renojim's avatar
    renojim
    Community Streaming Expert
    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