无法解析redux observable上的POST调用



我正在开发一个react原生应用程序,并使用Observable.fromPromise进行POST调用,我得到了以下响应,但我不确定如何从代码方面捕获响应,我也收到了一些警告

响应:

PromiseObservable {_isScalar: false, promise: Promise, scheduler: undefined}
promise: Promise
_40: 0
_55: Promise
_40: 0
_55: Promise
_40: 0
_51: 3
_55: Response
bodyUsed: true
headers: Headers {map: {…}}
ok: true
status: 200
statusText: undefined
type: "default"
url: "http://localhost:9999/testPath/pathData"
_bodyBlob: Blob {_data: {…}}
_bodyInit: Blob {_data: {…}}
__proto__: Object
_65: 2
_72: null
__proto__: Object
_65: 3
_72: null
__proto__: Object
_65: 3
_72: null
__proto__: Object
scheduler: undefined
_isScalar: false
__proto__: Observable

警告:

YellowBox.js:67 Possible Unhandled Promise Rejection (id: 0):
Response {
"_bodyBlob": Blob {
"_data": Object {
"blobId": "D985543E-CD51-470C-91F9-3407AE59FDA1",
"name": "test-data",
"offset": 0,
"size": 0,
"type": "application/json",
},
},
"_bodyInit": Blob {
"_data": Object {
"blobId": "D985543E-CD51-470C-91F9-3407AE59FDA1",
"name": "test-data",
"offset": 0,
"size": 0,
"type": "application/json",
},
},
"bodyUsed": true,
"headers": Headers {
"map": Object {
"content-type": "application/json; charset=UTF-8",
"server": "Jetty(9.2.z-SNAPSHOT)",
"transfer-encoding": "Identity",
},
},
"ok": true,
"status": 200,
"statusText": undefined,
"type": "default",
"url": "http://localhost:9999/testPath/pathData",
}

我正在使用mergeMap来捕获响应,不确定为什么它在这种情况下不起作用

代码:

const testEpic: Epic<Action, ReduxState> = (
action$: ActionsObservable<any>,
store: MiddlewareAPI<any, ReduxState>,
) =>
action$
.ofType(TEST_GET)
.mergeMap((action) => {
return Observable.merge(
.fetch('/testPath/pathData', payload) // return part which is working properly
.mergeMap((response) => {
// calls not coming here for POST, PUT, DELETE even though it is status 200
})
)
}
)
.catch((error) => {
})

试试这个

fetch("/testPath/pathData", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

我已经解决了它,实际上它进入了"error"内部,因为contentType 不匹配