Comments (4)
@kwhitley Just adding my voice here, as this issue cost me a few hours to debug yesterday 😅
It feels weird to me that you can use the nice and handy Headers class everywhere but not when using these helpers. It does not just break this consistency, but requiring object-notation feels like a step back for me as well.
If you persist, I would, at the very least, detect the headers are in an unsupported format and alert developers to this. Of course, I should have looked at the code right away, but I just could not believe that Headers would work everywhere but here.
edit: my current workaround is to not use these helpers and always create a new Response from scratch.
from itty-router.
Folded on this one - #213 was merged and will be released shortly :)
Thanks for your patience!
from itty-router.
It does - just pass in headers in object-syntax!
json({ success: true }, {
headers: {
'set-cookie': 'blah=true'
}
})
Should do the trick :)
from itty-router.
See: #213
Appx 20 bytes adds support for this, but cascades to not only createResponse()
, but all the downstream helpers as well (json
, text
, etc), so my leaning is not worth the addition when the current implementation is simpler and lower-byte.
from itty-router.
Related Issues (20)
- Middleware functions don't seem to typecheck correctly for `request` HOT 5
- Can I list all routes defined by a router HOT 4
- How to Use Itty Router with Next.js? HOT 1
- Typescript router "Additional types" are ignored HOT 10
- Setting up cron trigger? HOT 2
- cors functions are stateful HOT 8
- Nested routers ergonomics HOT 8
- createCors().corsify eats additional Set-Cookie headers HOT 3
- `withContent` returns a 500 when no body is sent HOT 1
- CORS issue, no preflight request shown HOT 6
- PROPOSAL: CORS HOT 4
- multiple set-cookie headers are removed by corsify
- Exception thrown by withContent HOT 5
- Corsify override http error code. HOT 3
- typescript compilation error when using itty-router 5.0.5 HOT 3
- Uncaught TypeError: (src_default.middleware ?? []) is not iterable HOT 4
- Issue with CORS when response is cached HOT 2
- TS compilation error when using itty-router 5.0.17 HOT 11
- withContent middleware fails on BunJS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itty-router.