Closed nathan77886 closed 4 years ago
Hi, I am sorry I probably don't quite understand the situation here. Could you please check that the request body you are sending is in valid JSON format? And could you provide me the JSON body that's causing this issue? Thanks Jirka
like this: flask:
class Other(BaseModel):
something:str
@api_old.route('/api/other',methods=['GET'])
@ApiCallReport
@validate(query=Other)
def something():
something = request.query_params.something
return something
requests:
import requests
header = {
'Content-Type':'application/json'
}
url = '''http://192.168.1.45/v2/api/other?something=hello'''
response = requests.get(url,headers=header)
print(response.text)
in my response:
{
"info":"400 Bad Request: The browser (or proxy) sent a request that this server could not understand.",
"message":"error"
}
There was a problem caused by accessing body parameters even if there was no model defined. It is fixed in this commit.
The new version (0.0.5) should work fine.
Thank you for your feedback.
Cheers Jirka
When I use GET and the Content-Type in the header is application / json, body_params = request.get_json () in the core file will report werkzeug.exceptions.BadRequest
This is my request: