post body
laktak opened this issue · comments
Christian Zangl commented
Thanks for your project - I like the idea of dynamically generating the api instead of having to genereate the code in advance.
I ran into a bug while trying to specify a post body.
I'm trying to pass data as the post body to requests
:
c.addLink(_data={"url": "test", "title": "test"})
But there appears to be a bug when you create the kwargs:
File ".../site-packages/requests_openapi/core.py", line 115, in f
for k in kwargs:
RuntimeError: dictionary keys changed during iteration
It would be nice if you could add native support for a request body:
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Link"
}
}
}
},
Thanks!
weiyang commented
Hi, @laktak. Thank you for the feedback.
May you try c.addLink(json={"url": "test", "title": "test"})
?
Christian Zangl commented
Ah, yes, that works. Thank you!
weiyang commented
requests-openapi/requests_openapi/core.py
Line 120 in 8b8dbe1
This line of code is sloppy, I will fix it and enhance unit tests.
Thank you for the feedback again.