Hi There,
I also facing 400 Bad Request in response while sending request using Graphql.
Below is our code:
Blockquote*** Settings ***
Library SeleniumLibrary
Library RequestsLibrary
Library JSONLibrary
Library Collections
Library OperatingSystem
*** Variables ***
*** Test Cases ***
Do a POST Request and validate the response code, response body, and response headers
Create Session mysession http://127.0.0.1:8000
${file_name}= Get Binary File ${CURDIR}\\test.json
&{body}= create dictionary query= query { places { name } }
&{header}= create dictionary Content-Type=application/json
log to console ${file_name}
${response}= POST On Session mysession / data=${file_name} headers=${header}
log to console ${response}
Status Should Be 200 ${response}
Data file: test.json
query {
places {
name
}
}
The error occurred:
HTTPError: 400 Client Error: Bad Request for url: http://127.0.0.1:8000/
Do you guys have any idea on it please let me know.
Many thanks