gin-contrib / cors

Official CORS gin's middleware
https://gin-gonic.github.io/gin/
MIT License
1.79k stars 186 forks source link

Expose *gin.Context to AllowOriginFunc #67

Closed zapo closed 8 months ago

zapo commented 4 years ago

Allow users of AllowOriginFunc to have custom origin allowance logic based on request data or things stashed in gin.Context (in my case an other middleware is stashing allowed origins using gin.Context.Set).

Fixes #64

codecov-commenter commented 4 years ago

Codecov Report

Merging #67 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #67   +/-   ##
=======================================
  Coverage   93.02%   93.02%           
=======================================
  Files           3        3           
  Lines         172      172           
=======================================
  Hits          160      160           
  Misses         11       11           
  Partials        1        1           
Impacted Files Coverage Δ
cors.go 81.53% <ø> (ø)
config.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0223cb8...3041d01. Read the comment docs.

hiendaovinh commented 2 years ago

Can we have this shipped soon, please? With a rework to change parameter order by moving the context to the head? Thank you!

jub0bs commented 2 years ago

I'm curious about this... I believe that this functionality is a potentially dangerous misfeature. What are actual use cases? What kind of information about the request do you need? Note that none of the test cases currently illustrate how this functionality would be useful for...

appleboy commented 8 months ago

move to https://github.com/gin-contrib/cors/pull/140