akka / akka/akka-http

Allow HttpRequest entity content-type without parameters.

Open
#689 6 comments 0 reactions 0 assignees View on GitHub
1 - triaged
Dominant language
Scala
Stars
1.4k
Forks
584
Avg merge
14h 33m
Merged PRs (30d)
24

Description

According to the HTTP specification section [3.7](https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7), older HTTP clients/server may not be able to handle Media Type definition with parameters.
While implementing the test suite for [AWS Signature 4](https://github.com/akka/alpakka/pull/120), I did not found a way to build a HttpRequest, with body's content-type (media type) without parameters.
It is this possible with current implementation?

So, if I build a HttpRequest as:
`
HttpRequest(HttpMethods.getForKey(rawMethod.trim).getOrElse(HttpMethods.CONNECT), encodeIfRequired(rawUri),
headers, HttpEntity(body), HttpProtocols.getForKey(rawProtocol).getOrElse(HttpProtocols.HTTP/1.1))
`

And `headers` variable already contains a Content-Type header, then I'm expecting that this header will not be overwritten by HttpRequest implementation when the HttpEntity is created.

Contributor guide

Open the contributing guide

Research direction

Start by reading the HttpRequest construction path and HttpEntity content-type handling described in the issue. Trace how an existing Content-Type header is treated when the entity is created, then verify that a request can retain a media type without parameters and that the current behavior remains covered by regression testing.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.