HTTP POST Requests

Create issue
Issue #43 invalid
Myles Heinzen created an issue

I cannot seem to get HTTP POST requests to work.

Comments (9)

  1. Myles Heinzen reporter

    It seems to take a second as if it waiting on a reply, but does not return anything.

  2. Thomas Farr repo owner

    Can you give me an example of the URLs it's failing to POST to? Do these work in CC in Minecraft? As there shouldn't be any difference between them in HTTP API behavior as CCEmuRedux doesn't touch it.

  3. Thomas Farr repo owner

    This runs successfully for me in CCEmuRedux:"", "test_data=SomeStuff").readAll()

    As does pastebin put which uses Are you perhaps trying to post to an https site with a certificate that Java is unable to verify, like a letsencrypt one?

  4. Myles Heinzen reporter"", "test_data=SomeStuff").readAll()

    Seems fine for me too... I was first trying it with the ComputerCraft forums, and then Google for testing. Neither of those work still though.

  5. Thomas Farr repo owner

    That will be because neither of those accept POST requests, they're probably spitting out '405 Method Not Allowed' responses, which ComputerCraft just treats as a complete failure (Or any error status code response for that matter).

  6. Myles Heinzen reporter

    ComputerCraft forums should accept POST, I thought that is how searches are handled. I didn't realize that when a website doesn't accept POST, it just gets rejected as a 405.

  7. Thomas Farr repo owner

    I believe the issue with the forums is that it is blocking Java user agents. Because I can successfully POST to perform a search from cURL. But doing it from Java results in a 403 Forbidden response, unless the user agent is changed. Which would be why it fails from ComputerCraft.

  8. Myles Heinzen reporter

    Cool, I changed the user agent manually when I made the POST request, works now. Thanks!

  9. Log in to comment