Skip to content

Commit

Permalink
Fix authorization against Twitter (for real)
Browse files Browse the repository at this point in the history
In f7bb1a7, I yank-and-put the
authorization code for POST and GET in the other way around.
  • Loading branch information
tesaguri committed Apr 13, 2023
1 parent f1e84f6 commit 8b87a25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/twitter/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,15 @@ where
.header(ACCEPT_ENCODING, HeaderValue::from_static("gzip"));

if form {
let authorization = oauth.build(method.as_str(), uri, &req);
let authorization = oauth.build(method.as_str(), uri, &());
let data = json::to_vec(req).unwrap();
http.uri(Uri::from_static(uri))
.header(AUTHORIZATION, authorization)
.header(CONTENT_TYPE, HeaderValue::from_static("application/json"))
.body(data)
.unwrap()
} else {
let authorization = oauth.build(method.as_str(), uri, &());
let authorization = oauth.build(method.as_str(), uri, &req);
let uri = oauth1::to_uri_query(uri.to_owned(), req);
http.uri(uri)
.header(AUTHORIZATION, authorization)
Expand Down

0 comments on commit 8b87a25

Please sign in to comment.