我用这个声明了gotclient:
private static readonly gotClient = got.extend({
prefixUrl: 'http://abc.xyz',
responseType: 'json',
});
尝试使用请求正文进行发布请求
样品 1:
await SubmissionsService.gotClient.post<any>(`submissions?submissionId=${submissionDetails.formSubmissionId}`, {
body: { abc : xyz },
});
样本 2:
const raw = JSON.stringify({ name: xyz })
const options = {
body: { abc: xyz }
}
await SubmissionsService.gotClient.post<any>(`submissions?submissionId=${submissionDetails.formSubmissionId}`, {options});
两种方法都试过了,都没有成功!