File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Razor" >
22
33 <PropertyGroup >
4- <Version >9.5.11-beta01 </Version >
4+ <Version >9.5.11-beta02 </Version >
55 </PropertyGroup >
66
77 <ItemGroup >
Original file line number Diff line number Diff line change 1919 if ( headers [ 'Content-Type' ] === void 0 ) {
2020 headers [ 'Content-Type' ] = 'application/json; charset=utf-8'
2121 }
22- const contentType = headers [ 'Content-Type' ] ;
23- let postData = JSON . stringify ( data ) ;
24- if ( contentType . indexOf ( 'application/x-www-form-urlencoded' ) > - 1 ) {
25- postData = new URLSearchParams ( data ) . toString ( ) ;
26- }
27- result = await fetch ( url , {
22+
23+ const fetchOptions = {
2824 method : method ,
29- headers : headers ,
30- body : postData
31- } ) ;
25+ headers : headers
26+ }
27+
28+ if ( method === 'PUT' || method === 'POST' ) {
29+ const contentType = headers [ 'Content-Type' ] ;
30+ let postData = null ;
31+ if ( data ) {
32+ postData = JSON . stringify ( data ) ;
33+ if ( contentType . indexOf ( 'application/x-www-form-urlencoded' ) > - 1 ) {
34+ postData = new URLSearchParams ( data ) . toString ( ) ;
35+ }
36+ fetchOptions . body = postData ;
37+ }
38+ }
39+ result = await fetch ( url , fetchOptions ) ;
3240 if ( toJson === true ) {
3341 result = await result . json ( )
3442 }
You can’t perform that action at this time.
0 commit comments