hono icon indicating copy to clipboard operation
hono copied to clipboard

feat: allow crossOrigin in TimingOptions to be a function

Open jonahsnider opened this issue 1 year ago • 2 comments

Currently, hono/timing allows you to specify a value for crossOrigin in TimingOptions which is used to define the Timing-Allow-Origin header. In one of my apps, I wanted to change what origins are allowed programmatically (similar to how you might want to set different CORS headers depending on what route is triggered). This PR support for that.

Author should do the followings, if applicable

  • [ ] Add tests
  • [ ] Run tests
  • [x] yarn denoify to generate files for Deno

jonahsnider avatar Mar 16 '24 05:03 jonahsnider

Hi @jonahsnider !

This is a good feature! However, we must add a test. Can you add it?

yusukebe avatar Mar 16 '24 09:03 yusukebe

Yes, I'll try and add a test some time this weekend

jonahsnider avatar Mar 16 '24 09:03 jonahsnider

@yusukebe apologies for the big delay! I just added a test for the previously existing crossOrigin functionality, as well as the new behavior this PR adds. Please let me know if I should structure the test differently or make any other modifications.

jonahsnider avatar May 02 '24 20:05 jonahsnider

Hi @jonahsnider

@yusukebe apologies for the big delay!

No worry! I've rebased this into the next branch for the next minor release, v4.3.0. I'll merge now. Thanks!

yusukebe avatar May 03 '24 00:05 yusukebe

Sounds good, thanks!

jonahsnider avatar May 03 '24 00:05 jonahsnider