Skip to content

Instantly share code, notes, and snippets.

@insanitybit
Created May 11, 2020 17:48
Show Gist options
  • Save insanitybit/fbe0cbdd327f21f1e0061bd93be76681 to your computer and use it in GitHub Desktop.
Save insanitybit/fbe0cbdd327f21f1e0061bd93be76681 to your computer and use it in GitHub Desktop.
curl -H "Authorization: bearer AAAAAAAAAAABBBBBBBBBB" -X POST -d " \
{ \
\"query\": \"query { viewer { login }}\" \
} \
" https://api.github.com/graphql
let res = client
.post("https://api.github.com/graphql")
.bearer_auth("AAAAAAAAAAABBBBBBBBBB")
.json(
&serde_json::json!({
"query": "query { viewer { login }}"
})
)
.send()
.await?;
Returns:
[src/lib.rs:43] res = Response {
url: "https://api.github.com/graphql",
status: 403,
headers: {
"cache-control": "no-cache",
"connection": "close",
"content-type": "text/html; charset=utf-8",
"strict-transport-security": "max-age=31536000",
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-xss-protection": "1; mode=block",
"content-security-policy": "default-src 'none'; style-src 'unsafe-inline'",
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment