message: ureq working
diff: //! The client implementation for the ureq HTTP client, which is blocking.
  -use super::{headers, BaseHTTPClient, Form, Headers, Query};
  -use crate::client::{ClientError, ClientResult, Spotify};
  +use super::{BaseHTTPClient, Form, Headers, Query};
  +use crate::client::{ClientError, ClientResult};
  use maybe_async::sync_impl;
  use serde_json::Value;
  @@ -35,26 +35,20 @@ impl UreqClient {
  D: Fn(Request) -> Result<Response, ureq::Error>,
  {
  // Setting the headers, which will be the token auth if unspecified.
  - match headers {
  - Some(headers) => {
  + if let Some(headers) = headers {
  for (key, val) in headers.iter() {
  request = request.set(&key, &val);
  }
  }
  - None => {
  - let (key, val) = headers::bearer_auth(self.get_token()?);
  - request = request.set(&key, &val);
  - }
  - }
  log::info!("Making request {:?}", request);
  match send_request(request) {
  + // Successful request
  Ok(response) => response.into_string().map_err(Into::into),
  + // HTTP status error
  Err(ureq::Error::Status(_, response)) => Err(ClientError::from_response(response)),
  - Err(err) => {
  // Some kind of IO/transport error
  - Err(ClientError::Request(err.to_string()))
  - }
  + Err(err) => Err(ClientError::Request(err.to_string())),
  }
  }
  }
  @@ -63,7 +57,7 @@ impl UreqClient {
  impl BaseHTTPClient for UreqClient {
  #[inline]
  fn get(&self, url: &str, headers: Option<&Headers>, payload: &Query) -> ClientResult<String> {
  - let request = ureq::get(&self.endpoint_url(url));
  + let request = ureq::get(url);
  let sender = |mut req: Request| {
  for (key, val) in payload.iter() {
  req = req.query(&key, &val)
  @@ -75,7 +69,7 @@ impl BaseHTTPClient for UreqClient {
  #[inline]
  fn post(&self, url: &str, headers: Option<&Headers>, payload: &Value) -> ClientResult<String> {
  - let request = ureq::post(&self.endpoint_url(url));
  + let request = ureq::post(url);
  let sender = |req: Request| req.send_json(payload.clone());
  self.request(request, headers, sender)
  }
  @@ -87,7 +81,7 @@ impl BaseHTTPClient for UreqClient {
  headers: Option<&Headers>,
  payload: &Form,
  ) -> ClientResult<String> {
  - let request = ureq::post(&self.endpoint_url(url));
  + let request = ureq::post(url);
  let sender = |req: Request| {
  let payload = payload
  .iter()
  @@ -102,7 +96,7 @@ impl BaseHTTPClient for UreqClient {
  #[inline]
  fn put(&self, url: &str, headers: Option<&Headers>, payload: &Value) -> ClientResult<String> {
  - let request = ureq::put(&self.endpoint_url(url));
  + let request = ureq::put(url);
  let sender = |req: Request| req.send_json(payload.clone());
  self.request(request, headers, sender)
  }
  @@ -114,7 +108,7 @@ impl BaseHTTPClient for UreqClient {
  headers: Option<&Headers>,
  payload: &Value,
  ) -> ClientResult<String> {
  - let request = ureq::delete(&self.endpoint_url(url));
  + let request = ureq::delete(url);
  let sender = |req: Request| req.send_json(payload.clone());
  self.request(request, headers, sender)
  }
  