# Http().singleRequest response header missing

**URL:** <https://discuss.akka.io/t/http-singlerequest-response-header-missing/2131>\
**Category:** Akka HTTP\
**Created:** [September 15, 2018, 8:41pm UTC](https://discuss.akka.io/t/http-singlerequest-response-header-missing/2131 "2018-09-15T20:41:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nico](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@nico](https://discuss.akka.io/u/nico)\
**Post date:** [September 15, 2018, 8:41pm UTC](https://discuss.akka.io/t/http-singlerequest-response-header-missing/2131/1 "2018-09-15T20:41:04Z")

</div>

Hi,  
I’m using a basic code to make a single request on : “[https://json-ld.org/test-suite/tests/compact-0002-in.jsonld](https://json-ld.org/test-suite/tests/compact-0002-in.jsonld)”

```auto
    Http()
      .singleRequest(
        HttpRequest(uri = iri.toString, entity = HttpEntity(ContentTypes.`application/json`, ByteString.empty)))
      .flatMap {
        case resp @ HttpResponse(StatusCodes.OK, _, _, _) =>
          resp.entity.dataBytes.runFold(ByteString(""))(_ ++ _).map { body =>
            println(resp.headers)
            //val links = headers.collect { case `Link`(l) => l }
            val contentType =
              resp.headers.collect { case `Content-Type`(c) => c } match {
                case seq if seq.isEmpty => None
                case seq => Some(seq.head.mediaType.toString())
              }
            RemoteDocument(None, "", contentType, body.utf8String)
          }
      }

```

When running, this codes prints the following response headers list:

```auto
List(Accept-Ranges: bytes, Access-Control-Allow-Origin: *, Date: Sat, 15 Sep 2018 20:27:41 GMT, ETag: "209fa-157-4c934c92292ae", Last-Modified: Sat, 08 Sep 2012 18:20:56 GMT, Server: Apache/2.2.22 (Ubuntu), Vary: Accept-Encoding)

```

The same URL retrieve with curl gives:

```auto
< HTTP/2 200 
< accept-ranges: bytes
< access-control-allow-origin: *
< content-type: application/ld+json
< date: Sat, 15 Sep 2018 20:35:33 GMT
< etag: "209fa-157-4c934c92292ae"
< last-modified: Sat, 08 Sep 2012 18:20:56 GMT
< server: Apache/2.2.22 (Ubuntu)
< vary: Accept-Encoding
< content-length: 343
< 
...

```

**problem** : the content type header (`content-type: application/ld+json`) is missing from HttpResponse but it appears when using curl. Any idea why this header is not retrieved from akka HttpResponse ?

---

<div class="post-metadata">

**Author:** ![nico](https://avatars.discourse-cdn.com/v4/letter/n/b5a626/32.png) [@nico](https://discuss.akka.io/u/nico)\
**Post date:** [September 16, 2018, 8:28am UTC](https://discuss.akka.io/t/http-singlerequest-response-header-missing/2131/2 "2018-09-16T08:28:37Z")

</div>

Hi,  
I found out that the content-type header value was available in the HTTP response entity `contentType` attritube.

---

<div class="post-metadata">

**Author:** ![jrudolph](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/jrudolph/32/80_2.png) [@jrudolph](https://discuss.akka.io/u/jrudolph)\
**Post date:** [September 16, 2018, 8:53am UTC](https://discuss.akka.io/t/http-singlerequest-response-header-missing/2131/3 "2018-09-16T08:53:32Z")

</div>

Hi nico,

glad you found out. In case, you haven’t seen it, the documentation has a section about special cased headers in akka-http:

[https://doc.akka.io/docs/akka-http/current/common/http-model.html#http-headers](https://doc.akka.io/docs/akka-http/current/common/http-model.html#http-headers)

Johannes
