how to get body.source?
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
in my route I have the following
called on like so
resulting in
GET ME OUT
get this is Response {
[Symbol(realm)]: { settingsObject: {} },
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: false,
requestIncludesCredentials: false,
type: 'default',
status: 200,
timingInfo: null,
cacheState: '',
statusText: '',
headersList: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
},
urlList: [],
body: { stream: undefined, source: '"Cat :)"', length: 8 }
},
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: Map(1) { 'content-type' => [Object] },
[Symbol(headers map sorted)]: null
}
}
get this is object
get this is []
I tried getCall.body.source & getCall.body
but I can't seem to get the value
export async function GET() {
console.log("GET");
return new Response(JSON.stringify(`Cat :)`), {
status: 200,
});
}called on like so
const res = await import("../api/trial/route");
const getCall = res.GET();
console.log("get this is",((await gut)));
console.log("get this is",(typeof((await gut))));
console.log("get this is",(Object.entries((await gut))));resulting in
GET ME OUT
get this is Response {
[Symbol(realm)]: { settingsObject: {} },
[Symbol(state)]: {
aborted: false,
rangeRequested: false,
timingAllowPassed: false,
requestIncludesCredentials: false,
type: 'default',
status: 200,
timingInfo: null,
cacheState: '',
statusText: '',
headersList: HeadersList {
cookies: null,
[Symbol(headers map)]: [Map],
[Symbol(headers map sorted)]: null
},
urlList: [],
body: { stream: undefined, source: '"Cat :)"', length: 8 }
},
[Symbol(headers)]: HeadersList {
cookies: null,
[Symbol(headers map)]: Map(1) { 'content-type' => [Object] },
[Symbol(headers map sorted)]: null
}
}
get this is object
get this is []
I tried getCall.body.source & getCall.body
but I can't seem to get the value