httpbun: Image put/post returns no content

Thanks for this project and for providing this as service!

I am trying to move some code that used httpbin which puts/posts an image/json. When trying this with httpbun I get a 200 response with content missing. I would still expect to get a JSON response. httpbin returns a data field with data:application/octet-stream;base64,DATA.

Is that something that could be implemented?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Thanks, confirmed working!

Okay, even with application/octet-stream, postman-echo.com responds with the byte integer list, but httpbin.org (and pie.dev) respond with the base64 of the data. 🤷

But this also made the response size from postman-echo.com be ~13x that from httpbin.org. For example, 16Kb became 200Kb.

Considering this, I’m leaning towards base64. Also, from what I know, most languages come with standard utility functions to convert a base64 string to a byte-array (Python and Golang both do), and is usually more straightforward than converting a list of integers into a byte array.

I’m going to soon start with the base64 implementation, similar to how httpbin does it. Hope that’s okay?

I am uploading a PNG file and try to convert the response data field back to a png but it never matches.

Got it. I don’t have a test for this yet, but let me look into this. This is a problem statement I can test and troubleshoot. I’ll get back soon, depending on bandwidth. 🙂

Well httbun returns 12288 as the highest content length I can reach by playing around in the CLI. But the difference is probably encoding related.

"headers": {
    "Accept": "*/*",
    "Accept-Encoding": "deflate, gzip",
    "Connection": "close",
    "Content-Length": "12288",
    "Content-Type": "image/png",
    "User-Agent": "Dart/3.0 (dart:io)"
  }

I will try to use a smaller sample image in my tests and see how it goes. Thanks!