swaggo / gin-swagger

gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
MIT License
3.76k stars 270 forks source link

Update multiple API example #224

Closed fzdy1914 closed 2 years ago

fzdy1914 commented 2 years ago

Describe the PR Update the example to use NewHandler()

Relation issue https://github.com/swaggo/gin-swagger/issues/197 https://github.com/swaggo/gin-swagger/issues/223

Additional context Reason for the fix: swaggerFiles.Handler is one single instance and patching the Prefix twice will end up making the request from first prefix invalid.

ubogdan commented 2 years ago

Would you mind adding a unit test proving that CSS files are accessible after accessing the second API endpoint?

codecov[bot] commented 2 years ago

Codecov Report

Merging #224 (791e433) into master (b9e926c) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #224   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           98        98           
=========================================
  Hits            98        98           

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 b9e926c...791e433. Read the comment docs.