1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-16 05:06:33 +00:00

update json example

This commit is contained in:
ami44 2017-12-30 16:08:18 +01:00
parent e93af57fa7
commit d7d9e8c0e9
2 changed files with 12 additions and 1 deletions

View file

@ -12,7 +12,7 @@ cargo run
# Started http server: 127.0.0.1:8080 # Started http server: 127.0.0.1:8080
``` ```
### client ### web client
With [Postman](https://www.getpostman.com/) or [Rested](moz-extension://60daeb1c-5b1b-4afd-9842-0579ed34dfcb/dist/index.html) With [Postman](https://www.getpostman.com/) or [Rested](moz-extension://60daeb1c-5b1b-4afd-9842-0579ed34dfcb/dist/index.html)
@ -36,3 +36,13 @@ With [Postman](https://www.getpostman.com/) or [Rested](moz-extension://60daeb1c
- url : ``http://127.0.0.1:8080/mjsonrust`` - url : ``http://127.0.0.1:8080/mjsonrust``
- header : ``Content-Type`` = ``application/json`` - header : ``Content-Type`` = ``application/json``
- body (raw) : ``{"name": "Test user", "number": 100}`` (you can also test ``{notjson}``) - body (raw) : ``{"name": "Test user", "number": 100}`` (you can also test ``{notjson}``)
### python client
- ``pip install aiohttp``
- ``python client.py``
if ubuntu :
- ``pip3 install aiohttp``
- ``python3 client.py``

View file

@ -11,6 +11,7 @@ async def req():
data=json.dumps({"name": "Test user", "number": 100}), data=json.dumps({"name": "Test user", "number": 100}),
headers={"content-type": "application/json"}) headers={"content-type": "application/json"})
print(str(resp)) print(str(resp))
print(await resp.text())
assert 200 == resp.status assert 200 == resp.status