Skip to content

Unsupported media type for a third party API #535

Answered by Quafadas
Quafadas asked this question in Q&A
Discussion options

You must be logged in to vote

Riiiiiiiiiiiiiiiiight. I've figured this out and it's kind of an obvious but (personally massive) gotcha in hindsight. As always - thanks for writing back.

Pop quiz - what's wrong here?

  private def authMiddleware(inTok: String): org.http4s.client.Middleware[IO] = { (client: Client[IO]) =>
    Client { req =>
      client.run(
        req.withHeaders(
          headers.Authorization(Credentials.Token(AuthScheme.Bearer, inTok))
        )
      )
    }
  }

Well, I'm going to go out on a limb and say that smithy does all the right things, and adds it's "I'm json" headers. I then come along, trample and replace (including but not limited to the content-type header) your excellent work with …

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@daddykotex
Comment options

Comment options

You must be logged in to vote
3 replies
@Quafadas
Comment options

@daddykotex
Comment options

@Baccata
Comment options

Answer selected by Baccata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants