File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
javascript/src/openapi/http Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,16 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
32
32
let method = request . getHttpMethod ( ) . toString ( ) ;
33
33
let body = request . getBody ( ) ;
34
34
35
+ // Cloudflare Workers fail if the credentials option is used in a fetch call.
36
+ // This work around that. Source:
37
+ // https://github.com/cloudflare/workers-sdk/issues/2514#issuecomment-2178070014
38
+ const isCredentialsSupported = "credentials" in Request . prototype ;
39
+
35
40
return fetch ( request . getUrl ( ) , {
36
41
method : method ,
37
42
body : body as any ,
38
43
headers : request . getHeaders ( ) ,
39
- credentials : "same-origin"
44
+ credentials : isCredentialsSupported ? "same-origin" : undefined
40
45
} ) . then ( ( resp : any ) => {
41
46
const headers : { [ name : string ] : string } = { } ;
42
47
resp . headers . forEach ( ( value : string , name : string ) => {
You can’t perform that action at this time.
0 commit comments