HTTP: Make header Methods Accept CharSequences as Values
See original GitHub issueGatling 3.4 deprecates io.gatling.http.HeaderValues in favour of io.netty.handler.codec.http.HttpHeaderValues. Hence, all header value constants are now AsciiStrings, not Strings. However, the various methods for setting headers still demand Strings as values. They should be changed to accept CharSequences (or Expression[CharSequence]s) as values instead.
In a nutshell, I want to be able to write:
http("example")
    .get("/my/url")
    .header(ACCEPT, TEXT_HTML)
    .headers(Map(    
        CACHE_CONTROL → NO_CACHE,
        PRAGMA → NO_CACHE
    ))
currently, I am forced to write:
http("example")
   .get("/my/url")
   .header(ACCEPT, s"$TEXT_HTML")
   .headers(Map(    
       CACHE_CONTROL → s"$NO_CACHE",
       PRAGMA → s"$NO_CACHE"
   ))
Issue Analytics
- State:
 - Created 3 years ago
 - Comments:5 (3 by maintainers)
 
Top Results From Across the Web
HttpHeaders (Vert.x Stack - Docs 4.3.6 API)
Contains a bunch of useful HTTP headers stuff: methods for creating MultiMap instances; often used Header names; method to create optimized CharSequence ......
Read more >HttpHeaders (Netty API Reference (4.1.86.Final))
Provides the constants for the standard HTTP header names and values and commonly used utility methods that accesses an HttpMessage .
Read more >Accept - HTTP - MDN Web Docs
The Accept request HTTP header indicates which content types, expressed as MIME types, the client is able to understand.
Read more >MutableHttpRequest (javadoc 2.2.3 API)
An extended version of HttpRequest that allows mutating headers, the body etc. ... ACCEPT header. ... Methods inherited from interface io.micronaut.http.
Read more >HttpHeaders (Vertx Javadocs 3.9.6.GA API)
Contains often used Header names. It also contains a utility method to create optimized CharSequence which can be used as header name and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for reporting.
We’ll have to weight going this way or revert the deprecation. If we could the former, I’m afraid this is not something we’ll be able to do before Gatling 3.5.0 because it would break binary compatibility.
#3973 is also a good solution for us. Thank you for addressing the issue!