@@ -26,12 +26,12 @@ const ProxyEditPanel = () => {
2626 url : '/_api/' ,
2727 status : '200' ,
2828 statusText : 'OK' ,
29- responseHeaders : {
29+ responseHeaders : JSON . stringify ( {
3030 'Content-Type' : 'application/json' ,
31- } ,
32- responseBody : {
31+ } ) ,
32+ responseBody : JSON . stringify ( {
3333 message : 'Success' ,
34- } ,
34+ } ) ,
3535 description : '' ,
3636 } ) ;
3737
@@ -74,7 +74,7 @@ const ProxyEditPanel = () => {
7474 }
7575
7676 const data = await response . json ( ) ;
77- setSampleData ( data ) ;
77+ setSampleData ( JSON . stringify ( data , null , 2 ) ) ;
7878 } catch ( error ) {
7979 setSampleData ( undefined ) ;
8080 }
@@ -244,9 +244,9 @@ const ProxyEditPanel = () => {
244244 label = "Response Headers"
245245 multiline
246246 autoAdjustHeight
247- value = { JSON . stringify ( localProxy . responseHeaders , null , 2 ) }
247+ value = { typeof localProxy . responseHeaders === 'object' ? JSON . stringify ( localProxy . responseHeaders , null , 2 ) : localProxy . responseHeaders }
248248 onChange = { ( e , newValue ) =>
249- setLocalProxy ( { ...localProxy , responseHeaders : newValue ? JSON . parse ( newValue ) : { } } )
249+ setLocalProxy ( { ...localProxy , responseHeaders : newValue ?? '' } )
250250 }
251251 styles = { { root : { width : '100%' } } }
252252 />
@@ -255,9 +255,9 @@ const ProxyEditPanel = () => {
255255 label = "Response Body"
256256 multiline
257257 autoAdjustHeight
258- value = { JSON . stringify ( localProxy . responseBody , null , 2 ) }
258+ value = { typeof localProxy . responseBody === 'object' ? JSON . stringify ( localProxy . responseBody , null , 2 ) : localProxy . responseBody }
259259 onChange = { ( e , newValue ) =>
260- setLocalProxy ( { ...localProxy , responseBody : newValue ? JSON . parse ( newValue ) : { } } )
260+ setLocalProxy ( { ...localProxy , responseBody : newValue ?? '' } )
261261 }
262262 styles = { { root : { width : '100%' } } }
263263 />
0 commit comments