Skip to content

Commit 7d01172

Browse files
committed
set http headers and bind fetch client
1 parent 0905da1 commit 7d01172

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Tocsoft.GraphQLCodeGen.Cli/Templates/ts/Function/typescript.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{{!# ClientClassDecorators }}
44

55
{{!# FetchCient }}
6-
fetch
6+
window.fetch.bind(window)
77

88
{{!# ApiUrl }}
99
{{error 'TemplateSettings.ApiUrl or TemplateSettings.UrlConfig muse be specified for loading the api base url' }}
@@ -105,6 +105,7 @@ export class {{pascalCase Name}} {
105105
export function {{camelCase OperationName}}({{> ArgumentList Arguments}}) : Promise<{{> TypeReference ResultType}}>{
106106
return client.fetch(url, {
107107
method : 'POST',
108+
headers: {'Content-Type': 'application/json'},
108109
body : JSON.stringify({
109110
query : `{{replace Query '`' '\`'}}`,
110111
variables : {

0 commit comments

Comments
 (0)