Adds the given HTTP headers to all responses coming back from its inner route only if a respective header with the same name doesn’t exist yet in the response.


def respondWithSingletonHeaders(responseHeaders: HttpHeader*): Directive0 
def respondWithSingletonHeaders(responseHeaders: List[HttpHeader]): Directive0 


This directive transforms HttpResponse and ChunkedResponseStart messages coming back from its inner route by potentially adding the given HttpHeader instances to the headers list. A header is only added if there is no header instance with the same name (case insensitively) already present in the response. If you’d like to add only a single header you can use the respondWithSingletonHeader directive instead.


See the respondWithSingletonHeader directive for an example with only one header.