Code Monkey home page Code Monkey logo

httpbun's Introduction

Namaste ๐Ÿ™

I am Shrikant. You have reached my public projects space. Feel free to look around, and don't forget to visit my blog at sharats.me.

httpbun's People

Contributors

sharat87 avatar spazzy757 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

httpbun's Issues

Feature Request: endpoint to pull environment

Situation

It would be beneficial to have an endpoint that returns the containers environment as a JSON object

There is a use case for this in for instance testing multi-backend routing (like canary deployments or blue/green deployments), it would be good to know when hitting the backend things like the hostname and any other identifying information that can be injected into the container to understand different patterns

Support OPTIONS/CORS

I have CORS requests which fail with "405: Method not allowed" when sending the pre-flight OPTIONS request.
It seems the response access control headers are correct but the OPTIONS method is considered not allowed because it is the put endpoint.

I think all endpoints should allow OPTIONS. What do you think?

/status endpoint does not respect Accept: */* header

It is common for http clients to default to sending an Accept: */* header on requests, e.g. Postman defaults to using this header on all requests unless overridden.

When a /status/* request is sent with Accept: */*, httpbun responds with an empty response, which caused me some confusion, especially given that passing a more specific header of Accept: application/json or Accept: text/plain does return a response body. This is due to the explicit Accept header matching logic here.

It may be more intuitive for users to support wildcard Accept headers, either by returning application/json or text/plain content by default when Accept: */* is received.

/status endpoint responds with incorrect content-type

When calling the status endpoint with an Accept: application/json header, json content is returned but the response contains a Content-Type: text-plain; charset=utf-8 header. I would expect to receive the response header Content-Type: application/json.

Here is a curl example to reproduce the issue:

curl -v 'https://httpbun.org/status/400' --header 'Accept: application/json'

which responds with:

< HTTP/2 400
< alt-svc: h3=":443"; ma=2592000
< content-type: text/plain; charset=utf-8
< date: Mon, 18 Mar 2024 19:10:32 GMT
< x-powered-by: httpbun/5025308c3a9df224c10faae403ae888ad5c3ecc5
< content-length: 50
<
{
  "code": 400,
  "description": "Bad Request"
}

Empty /status/ pages

Hi @sharat87, thanks for the alternative to httpbin! I now use it as the original website is not as reliable as it was.

Switching between both platforms is easy, the /status/ pages however function differently: since it's about the HTTP code, could you please copy httpbin's behavior returning empty HTML documents?

Especially for redirects it makes little sense to display a web page, e.g. "301 Moved Permanently" for http://httpbun.org/status/301. An empty page would be better.

What do you think?

`/headers` returns capitalized keys instead of original keys

Keys of headers should return as-is.

$ curl -H 'Sensitive: test' -H 'insensitive: test' https://httpbun.com/headers
{
  "Accept": "*/*",
  "Connection": "close",
  "Host": "httpbun.com",
  "Insensitive": "test",
  "Sensitive": "test",
  "User-Agent": "curl/8.2.1"
}

Could be affected by

name = http.CanonicalHeaderKey(name)

or
ex.ResponseWriter.Header().Add(name, value)

Python library

If there was a Python library built for the same, to test the flask applications that would be awesome.

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.