oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

chi-middleware/OapiRequestValidator returns Bad Request if BaseURL is set.

Open KasperOmsK opened this issue 2 years ago • 1 comments

When creating a chi HttpHander, setting the BaseURL to anything causes the OaopiRequestValidator middleware to intercept the request and return a 400 Bad Request.

return api.HandlerWithOptions(
		&impl{},
		api.ChiServerOptions{
			BaseURL: "/something",
			Middlewares: []api.MiddlewareFunc{
				oapimiddleware.OapiRequestValidator(spec),
			},
		},
	), nil

Is this working as intended ?

I found a similar issue for Echo : #806

KasperOmsK avatar Jun 09 '23 19:06 KasperOmsK

@KasperOmsK I've put some info for Echo #806 here, same applies for chi I think https://github.com/deepmap/oapi-codegen/issues/806#issuecomment-1594454038

msamad avatar Jun 18 '23 21:06 msamad