File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -103,14 +103,26 @@ class API {
103
103
}
104
104
105
105
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
+
114
126
if ( response . status === 200 ) {
115
127
return response . url
116
128
} else {
You can’t perform that action at this time.
0 commit comments