-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
Implementation
mockttp/src/util/request-utils.ts
Lines 233 to 237 in b50532a
async getJson() { | |
return runAsyncOrUndefined(async () => | |
JSON.parse((await completedBody.getText())!) | |
) | |
}, |
Types (why are these even separate?)
Lines 176 to 181 in b50532a
/** | |
* The contents of the response, decoded, parsed as UTF-8 string, and | |
* then parsed a JSON. The response is decoded and returned asynchronously | |
* as a Promise. | |
*/ | |
getJson(): Promise<object | undefined>; |
JSON.parse can not return undefined (but can return null, which is not the same) and can return more than just
object
s (numbers, strings).Probably best to just type getJson as Promise just like JSON.parse is typed as any.
Metadata
Metadata
Assignees
Labels
No labels