Giter Site home page Giter Site logo

Add json attribute to responses about httpbin HOT 6 CLOSED

vlucas avatar vlucas commented on April 28, 2024
Add json attribute to responses

from httpbin.

Comments (6)

rmccue avatar rmccue commented on April 28, 2024

Should be parsed into the form property, IMHO. data appears to always be the submitted data in binary form, regardless of type, and I think it should stay that way.

from httpbin.

kennethreitz avatar kennethreitz commented on April 28, 2024

json-encoded data isn't form data. It's just a set of bytes, as seen here.

from httpbin.

kennethreitz avatar kennethreitz commented on April 28, 2024

That being said, a json attribute might be in order.

from httpbin.

dmishe avatar dmishe commented on April 28, 2024

Maybe something like decode_content flag that will attempt to decode content based on content type header, which in this case should be application/json?

from httpbin.

kennethreitz avatar kennethreitz commented on April 28, 2024

I think that would be overkill. A json attribute makes sense though.

from httpbin.

kevin1024 avatar kevin1024 commented on April 28, 2024

Looks like this made it in :)

$ http post http://httpbin.org/post key=value
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 519
Content-Type: application/json
Date: Sun, 22 Jun 2014 21:54:09 GMT
Server: gunicorn/18.0

{
    "args": {},
    "data": "{\"key\": \"value\"}",
    "files": {},
    "form": {},
    "headers": {
        "Accept": "application/json",
        "Accept-Encoding": "gzip, deflate",
        "Connection": "close",
        "Content-Length": "16",
        "Content-Type": "application/json; charset=utf-8",
        "Host": "httpbin.org",
        "User-Agent": "HTTPie/0.8.0",
        "X-Request-Id": "37f30462-944c-488c-8c63-d4bc5519e771"
    },
    "json": {
        "key": "value"
    },
    "origin": "198.15.119.130",
    "url": "http://httpbin.org/post"
}

from httpbin.

Related Issues (20)

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.