go - Add unaltered lowercase headers to golang http request -


I am trying to set all lowercase titles in the Golland program and Canonical MIMEHeaderKey is scaling the first letter upper . The API I'm consuming only takes this special header in all lowercase at this time. It is not the option to change at this point in time. Is there any way to override it?

For example, the header I want to add is:

  req.Header.Add ("myheader", "myheadervalue" )   

But it is as follows:

  req.Header.Add ("Myheader", "myheadervalue")   

Can anyone help please?

Thanks

I do not see any way to protect it, but If you really have to use lower-case header names, you can work with your own http.Header with the following-case key Example (): < Pre> import "fmt" import "wire" import "net / http" // ... req, _: = http.NewRequest ("GET", "http: / / Foo", zero) req.Header .add ("myheader", "myheadervalue") lowerCaseHeader: = create for key (http.Header), value: = category req.Header {less CaseHeader [ Wire. ToLower (key)] = value} req.Header = lowerCaseHeader

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -