Skip to content

Commit

Permalink
fix(rover-client): send request body as string (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper authored Aug 20, 2021
1 parent 62b13c1 commit f6bbed8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions crates/rover-client/src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl GraphQLClient {
) -> Result<Q::ResponseData, RoverClientError> {
let header_map = build_headers(header_map)?;
let request_body = self.get_request_body::<Q>(variables)?;
let response = self.execute(&request_body, header_map)?;
let response = self.execute(request_body, header_map)?;
GraphQLClient::handle_response::<Q>(response)
}

Expand All @@ -57,7 +57,7 @@ impl GraphQLClient {

pub(crate) fn execute(
&self,
request_body: &str,
request_body: String,
header_map: HeaderMap,
) -> Result<Response, RoverClientError> {
tracing::trace!(request_headers = ?header_map);
Expand All @@ -67,7 +67,7 @@ impl GraphQLClient {
.client
.post(&self.graphql_endpoint)
.headers(header_map.clone())
.json(request_body)
.body(request_body.clone())
.send()
.map_err(backoff::Error::Permanent)?;

Expand Down Expand Up @@ -247,7 +247,7 @@ mod tests {
let client = ReqwestClient::new();
let graphql_client = GraphQLClient::new(&server.url(success_path), client).unwrap();

let response = graphql_client.execute("{}", HeaderMap::new());
let response = graphql_client.execute("{}".to_string(), HeaderMap::new());

let mock_hits = success_mock.hits();

Expand All @@ -268,7 +268,7 @@ mod tests {
let graphql_client =
GraphQLClient::new(&server.url(internal_server_error_path), client).unwrap();

let response = graphql_client.execute("{}", HeaderMap::new());
let response = graphql_client.execute("{}".to_string(), HeaderMap::new());

let mock_hits = internal_server_error_mock.hits();

Expand All @@ -288,7 +288,7 @@ mod tests {
let client = ReqwestClient::new();
let graphql_client = GraphQLClient::new(&server.url(not_found_path), client).unwrap();

let response = graphql_client.execute("{}", HeaderMap::new());
let response = graphql_client.execute("{}".to_string(), HeaderMap::new());

let mock_hits = not_found_mock.hits();

Expand Down
2 changes: 1 addition & 1 deletion crates/rover-client/src/blocking/studio_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl StudioClient {
) -> Result<Q::ResponseData, RoverClientError> {
let header_map = self.build_studio_headers()?;
let request_body = self.client.get_request_body::<Q>(variables)?;
let response = self.client.execute(&request_body, header_map)?;
let response = self.client.execute(request_body, header_map)?;
GraphQLClient::handle_response::<Q>(response)
}

Expand Down

0 comments on commit f6bbed8

Please sign in to comment.