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:
parent
e93af57fa7
commit
d7d9e8c0e9
2 changed files with 12 additions and 1 deletions
|
@ -12,7 +12,7 @@ cargo run
|
|||
# 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)
|
||||
|
||||
|
@ -36,3 +36,13 @@ With [Postman](https://www.getpostman.com/) or [Rested](moz-extension://60daeb1c
|
|||
- url : ``http://127.0.0.1:8080/mjsonrust``
|
||||
- header : ``Content-Type`` = ``application/json``
|
||||
- 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``
|
||||
|
|
|
@ -11,6 +11,7 @@ async def req():
|
|||
data=json.dumps({"name": "Test user", "number": 100}),
|
||||
headers={"content-type": "application/json"})
|
||||
print(str(resp))
|
||||
print(await resp.text())
|
||||
assert 200 == resp.status
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue