File tree Expand file tree Collapse file tree 3 files changed +26
-9
lines changed
sdks/src/components/content/components Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @builder.io/react " : patch
3+ " @builder.io/sdk-angular " : patch
4+ " @builder.io/sdk-react-nextjs " : patch
5+ " @builder.io/sdk-qwik " : patch
6+ " @builder.io/sdk-react " : patch
7+ " @builder.io/sdk-react-native " : patch
8+ " @builder.io/sdk-solid " : patch
9+ ---
10+
11+ Fix: Improved implementation of making Content http-requests with GET method
Original file line number Diff line number Diff line change @@ -1279,11 +1279,15 @@ export class BuilderComponent extends React.Component<
12791279 }
12801280 let json : any ;
12811281 try {
1282- const result = await fetch ( url , {
1282+ const fetchOptions = {
12831283 method,
12841284 headers,
1285- body : method === 'GET' ? undefined : body ,
1286- } ) ;
1285+ body,
1286+ } ;
1287+ if ( method === 'GET' ) {
1288+ delete fetchOptions . body ;
1289+ }
1290+ const result = await fetch ( url , fetchOptions ) ;
12871291 json = await result . json ( ) ;
12881292 } catch ( err ) {
12891293 const error = toError ( err ) ;
Original file line number Diff line number Diff line change @@ -243,14 +243,16 @@ export default function EnableEditor(props: BuilderEditorProps) {
243243
244244 logFetch ( JSON . stringify ( fetchRequestObj ) ) ;
245245
246- fetch ( fetchRequestObj . url , {
246+ const fetchOptions = {
247247 method : fetchRequestObj . method ,
248248 headers : fetchRequestObj . headers ,
249- body :
250- fetchRequestObj . method === 'GET'
251- ? undefined
252- : fetchRequestObj . body ,
253- } )
249+ body : fetchRequestObj . body ,
250+ } ;
251+ if ( fetchRequestObj . method === 'GET' ) {
252+ delete fetchOptions . body ;
253+ }
254+
255+ fetch ( fetchRequestObj . url , fetchOptions )
254256 . then ( ( response ) => response . json ( ) )
255257 . then ( ( json ) => {
256258 state . mergeNewRootState ( { [ key ] : json } ) ;
You can’t perform that action at this time.
0 commit comments