D
Deno

help

Is there a way to fetch() with headers, WITHOUT forcing header keys to lowercase?

Wwulfey1/30/2023
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) 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.
IioB1/30/2023
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?
ABTAndreu Botella (they/them)1/31/2023
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.
Wwulfey1/31/2023
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...)
UUUnknown User7/7/2023
Message Not Public
Sign In & Join Server To View
Wwulfey7/11/2023
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
UUUnknown User7/11/2023
Message Not Public
Sign In & Join Server To View
ABTAndreu Botella (they/them)7/11/2023
that will not work on deno or browsers, and if it did, that would be considered a bug
UUUnknown User7/11/2023
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

Recommended Posts
How do I use std/log?I'm trying to create a log file. I don't seem to be able to make it work tho. ```ts import { handleop_ffi_cstr_read replacement now that deno.core.ops is gone?The latest release removed Deno.core.ops, which a library of mine relied on to use `op_ffi_cstr_readNPM Import results in Rust panicLooking to import the Airgram NPM package because I don't want to write it from scratch at this momeDeno fmt conflicting with Deno lint, when using IIFE```ts // before formating ((): void => { /* code */ })() ``` after formating with deno fmt, it adds prototype dot functions. How?How would I go about creating dot function that can be chained at the end of a number in Deno? ExamRepublish a /x/ module from a deleted repoIs it possible to publish an old module from a new repo? i'v deleted an old one and created a new reHow to get Deno to fmt on save with VSCode?I have a deno.json file with some fmt options which works if run fromt the command line but not whenIntegrate Twin to Svelte+Vite+Deno as FreshIs there any way to integrate the use of Twind into the Stelte+Vite+Deno project as Fresh does? Thacan i render some pages as SPA and some as SSR in fresh?#fresh kanalına mesaj göndercan i render some pages as SPA and some as SSR in fresh? #fresh kanalına mesaj gönderHow can i return a base64 as file on Deno Deploy?Could someone give me an example for this?How to disable deno linter for whole project directory?I'm using deno with mixed project folders, some use Vue and shouldn't be linted by deno. How do i diHow can I get `npm` in the path for Deno.run()?I'm writing a script to automate a tedious npm task that I run frequently. When I use `Deno.run()` iUse Deno.run() to communicate with ArduinoHey I'm trying to communicate via USB serial with my Arduino. My goal is to have the result I get viBest place to host server side Deno AppI have a server side app I want to host in a specific region and I only want 1 instance of it runninNPM Import missing typesPlaying around with some deno code and testing a npm import, the original package has types (redaxioUpdate value by reference without duplicating the dataIm exploring the world of FFI, porting some C applications I have to TypeScript, with the help of Dehow to hash very large filesWe have deprecated the old std/hash code in favor of the crypto module, but I do not know what the sxstate - no types importedimport * as xstate from "https://deno.land/x/xstate@xstate@4.35.2/src/index.ts"; file is cached, yetexample of kysely running on deno deploy?Deno Deploy awesomely can connect to postgres directly from the edge https://deno.com/blog/deploy-poUpdating digest with web cryptoFor some context, I'm updating some code that was importing from `std/hash` (specifically `std/hash/