gateway
gateway copied to clipboard
fix: work around `immutable` header guard
trafficstars
Description
This PR fixes the ResponseService.updateHeaders method to not try to mutate response headers, since it is forbidden by the fetch spec.
Resolves https://github.com/Portkey-AI/gateway/issues/1389.
Motivation
Users who install incompatible (i.e. modern) versions of @hono/node-server will end up with response errors when using Portkey.
Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
How Has This Been Tested?
- [ ] Unit Tests
- [ ] Integration Tests
- [x] Manual Testing
Screenshots (if applicable)
Checklist
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
Related Issues
https://github.com/Portkey-AI/gateway/issues/1389