File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,14 +103,26 @@ class API {
103103 }
104104
105105 async newNote ( body : string ) {
106- const contentType = 'text/markdown;charset=UTF-8'
107- const response = await this . fetch ( `${ this . serverUrl } /new` , {
108- method : 'POST' ,
109- body,
110- headers : {
111- 'Content-Type' : contentType
112- }
113- } )
106+ let response
107+ if ( this . enterprise ) {
108+ response = await this . fetch ( `${ this . serverUrl } /new` , {
109+ method : 'POST' ,
110+ body : encodeFormComponent ( { content : body } ) ,
111+ headers : await this . wrapHeaders ( {
112+ 'Content-Type' : 'application/x-www-form-urlencoded;charset=UTF-8' ,
113+ } )
114+ } )
115+ } else {
116+ const contentType = 'text/markdown;charset=UTF-8'
117+ response = await this . fetch ( `${ this . serverUrl } /new` , {
118+ method : 'POST' ,
119+ body,
120+ headers : {
121+ 'Content-Type' : contentType
122+ }
123+ } )
124+ }
125+
114126 if ( response . status === 200 ) {
115127 return response . url
116128 } else {
You can’t perform that action at this time.
0 commit comments