Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to fetch from swagger #4

Open
suntong opened this issue Aug 25, 2023 · 1 comment
Open

Failed to fetch from swagger #4

suntong opened this issue Aug 25, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@suntong
Copy link

suntong commented Aug 25, 2023

Description of the bug

When testing the API from swagger, I always get "Failed to fetch" error.
Doing it on CLI is fine though.

Steps To Reproduce

  1. Go to http://my.server.name:5050/docs/
  2. Test the "Register" API from swagger

Additional Information

image

The reason that I'm reporting here is that, I'm also trying another template -- https://github.com/create-go-app/fiber-go-template/, which seems to be doing no difference than what you're doing regarding CORS:

package middleware

import (
        "github.com/gofiber/fiber/v2"
        "github.com/gofiber/fiber/v2/middleware/cors"
        "github.com/gofiber/fiber/v2/middleware/logger"
)

// FiberMiddleware provide Fiber's built-in middlewares.
// See: https://docs.gofiber.io/api/middleware
func FiberMiddleware(a *fiber.App) {
        a.Use(
                // Add CORS to each route.
                cors.New(),
                // Add simple logger.
                logger.New(),
        )
}

Yet, its CORS/swagger is working just fine:

image

What could possibly cause the difference?
How can I make the swagger work out of the box please?

@suntong suntong added the bug Something isn't working label Aug 25, 2023
@solrac97gr
Copy link
Owner

I will take a look about this, considering I am also using the CORS middleware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants