# Java - Passing Multiple Headers

**URL:** <https://community.gatling.io/t/java-passing-multiple-headers/6365>\
**Category:** Gatling (Open-Source)\
**Created:** [December 25, 2021, 7:51pm UTC](https://community.gatling.io/t/java-passing-multiple-headers/6365 "2021-12-25T19:51:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bharath\_Marrivada](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Bharath\_Marrivada](https://community.gatling.io/u/Bharath_Marrivada)\
**Post date:** [December 25, 2021, 7:51pm UTC](https://community.gatling.io/t/java-passing-multiple-headers/6365/1 "2021-12-25T19:51:42Z")

</div>

Hello All,

I am using Gatling 3.7.3 on Java 17.  
I have recorded the test scenario, the following code got generated by the Gatling, but this code is giving the error.

private Map\<CharSequence, String\> headers\_3 = Map.ofEntries(  
Map.entry(“Accept”, “image/avif,image/webp,\*\*”),  
Map.entry(“Cache-Control”, “max-age=0”),  
Map.entry(“If-Modified-Since”, “Fri, 24 Jan 2020 16:49:16 GMT”),  
Map.entry(“If-None-Match”, “”"“5e2b200c-62b4"”""),  
Map.entry(“Sec-Fetch-Dest”, “image”),  
Map.entry(“Sec-Fetch-Mode”, “no-cors”),  
Map.entry(“Sec-Fetch-Site”, “same-origin”)  
);

I have checked the documentation [https://gatling.io/docs/gatling/reference/current/http/request/#headers](https://gatling.io/docs/gatling/reference/current/http/request/#headers)  
. It shows the following example for Java, but giving an error “params” is not resolved.

_Map\<String, String\> sentHeaders = new HashMap\<\>();_  
_params.put(“content-type”, “application/javascript”);_  
_params.put(“accept”, “text/html”);_

Can anyone suggest to me the correct definition for Headers?

Regards,  
Bharath.
