I have setup an Azure Function using the Java runtime locally and have published it to Azure. Everything has been fairly smooth so far with one caveat.
Inside my function body, I need to interact with the HTTP Request Headers. This is an easy enough task - just make a call to request.getHeaders() which should return a Map<String, String>.
Then I can just interact with the map in the regular way, e.g. calling .get(), passing it the name of the header I want.
However, any call to get a header from the Map returns null.
Here is my curl request to my function with the headers I expect to the see in the request.
* Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 7071 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 7071 (#0)
> GET /api/HttpTrigger-Java?company=boom&location=ok HTTP/1.1
> Host: localhost:7071
> User-Agent: curl/7.54.0
> Accept: */*
> CustomHeader: boom
And here is a picture showing the output of the getHeaders() call.
Can anybody offer some recommendations? Is there anything I have to do to make the request headers be injected into the getHeaders() variable?
I have setup an Azure Function using the Java runtime locally and have published it to Azure. Everything has been fairly smooth so far with one caveat. Inside my function body, I need to interact with the HTTP Request Headers. This is an easy enough task - just make a call to
request.getHeaders()
which should return aMap<String, String>
. Then I can just interact with the map in the regular way, e.g. calling.get()
, passing it the name of the header I want.However, any call to get a header from the Map returns null.
Here is my curl request to my function with the headers I expect to the see in the request.
And here is a picture showing the output of the getHeaders() call.
Can anybody offer some recommendations? Is there anything I have to do to make the request headers be injected into the getHeaders() variable?