Is there a way to fetch() with headers, WITHOUT forcing header keys to lowercase?
Title. I'm trying to create an API wrapper for a service which uses "Incapsula" as their firewall or something like that.
Issue is, when making a
fetch()
request through Deno, the request gets blocked, with the exact same required header and parameter structure as done through say a web browser (simple GET) or an API testing app.
I noticed that the flushed HTTP headers are forced lowercase (which is good, in most cases), which I feel like is causing issues with this very specific API (specifically, only my Deno requests are blocked).
Any way to flush headers as-is? (Or is a custom request/fetch library required for this)9 Replies
update: just checked, it is in fact the lowercase header keys which trip the.... firewall thing?
this is weird. i coded up a simple, primitive http 1.0 request library to prove this
Naturally, it would be much better if I could use the built in
fetch()
for this.with the exact same required header and parameter structure as done through say a web browser (simple GET) or an API testing app.How are you making requests through the browser? If you're using fetch, the request should be identical?
Nope. The fetch spec doesn't specify how HTTP requests should be sent exactly, and it doesn't say anything in particular about the casing of header names.
And since per HTTP header names are case-insensitive, and the
Headers
class treats header names case-insensitively, I'd say it's fine for Deno to implement it like that
Safari also ignores the casing in header names, for some of the more common headers. But I think it uppercases the first letter of every word, rather than lowercasing everything.apologies for latency
by "request through browser", i literally mean heading towards an api endpoint (no auth, GET)
this is completely fine in my opinion, i have nothing against that
(its just extremely weird how all-lowercase header names wreak havoc on the api's server side...)
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i did not, what i did was create a very sparse HTTP/2 request module just for the purpose i needed it for
sorry for the late response
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that will not work on deno or browsers, and if it did, that would be considered a bug
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View