Skip to content

Commit a61dcd7

Browse files
authored
fix: Resolve CORS errors in OpenAPI tab of Playground (#3263)
## Relevant issue(s) Resolves #2458 ## Description There was a bug in the Playground's OpenAPI tool. This tool would list the URL of the endpoints as localhost instead of 127.0.0.1 (which is what the startup Defradb message shows.) The result was that attempting to execute one of the queries returned a CORS error. This was a one-liner fix. I adjusted openapi.go to use `http://127.0.0.1:9181/api/v0` as a string literal for the URL, instead of `http://localhost:9181/api/v0` ## Tasks - [x] I made sure the code is well commented, particularly hard-to-understand areas. - [x] I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in nts, ## How has this been tested? The platform(s) on which this was tested: - Windows
1 parent 6cacff1 commit a61dcd7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/website/references/http/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@
23632363
"servers": [
23642364
{
23652365
"description": "Local DefraDB instance",
2366-
"url": "http://localhost:9181/api/v0"
2366+
"url": "/api/v0"
23672367
}
23682368
],
23692369
"tags": [

http/openapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func NewOpenAPISpec() (*openapi3.T, error) {
111111
Servers: openapi3.Servers{
112112
&openapi3.Server{
113113
Description: "Local DefraDB instance",
114-
URL: "http://localhost:9181/api/v0",
114+
URL: "/api/v0",
115115
},
116116
},
117117
ExternalDocs: &openapi3.ExternalDocs{

0 commit comments

Comments
 (0)