Skip to content

Commit e5e5a07

Browse files
committed
fix: return content type and send servers with https
1 parent 2fb4da1 commit e5e5a07

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

api/0_build.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ func Build(s service.Servicer, staticsDir, version string) *box.B { // TODO: rem
1717
b := box.NewBox()
1818

1919
v1 := b.Resource("/v1")
20+
v1.WithInterceptors(box.SetResponseHeader("Content-Type", "application/json"))
21+
2022
apicollectionv1.BuildV1Collection(v1, s).
2123
WithInterceptors(
2224
injectServicer(s),
@@ -44,13 +46,12 @@ func Build(s service.Servicer, staticsDir, version string) *box.B { // TODO: rem
4446
}
4547
b.Handle("GET", "/openapi.json", func(r *http.Request) any {
4648

47-
scheme := "http"
48-
if r.TLS != nil {
49-
scheme = "https"
50-
}
5149
spec.Servers = []boxopenapi.Server{
5250
{
53-
Url: scheme + "://" + r.Host,
51+
Url: "https://" + r.Host,
52+
},
53+
{
54+
Url: "http://" + r.Host,
5455
},
5556
}
5657

0 commit comments

Comments
 (0)