Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homepage POST example should use json shorthand #278

Closed
twm opened this issue Apr 5, 2020 · 0 comments · Fixed by #284
Closed

Homepage POST example should use json shorthand #278

twm opened this issue Apr 5, 2020 · 0 comments · Fixed by #284
Assignees

Comments

@twm
Copy link
Contributor

twm commented Apr 5, 2020

The current example could use the json shorthand:

def main(reactor, *args):
    d = treq.post('https://httpbin.org/post',
                  json.dumps({"msg": "Hello!"}).encode('ascii'),
                  headers={b'Content-Type': [b'application/json']})
    d.addCallback(print_response)
    return d

We should certainly have an example of data, but putting this particular example on the homepage implies that json doesn't exist.

@twm twm added the enhancement label Apr 5, 2020
@twm twm self-assigned this Apr 6, 2020
@twm twm closed this as completed in #284 Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant