本文整理汇总了TypeScript中helpers/api_request_builder.ApiRequestBuilder.POST方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ApiRequestBuilder.POST方法的具体用法?TypeScript ApiRequestBuilder.POST怎么用?TypeScript ApiRequestBuilder.POST使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers/api_request_builder.ApiRequestBuilder
的用法示例。
在下文中一共展示了ApiRequestBuilder.POST方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should create ApiResult from a successful POST request", (done) => {
mockSuccessfulCreatedRequest();
ApiRequestBuilder.POST("/foo", ApiVersion.v1).then((result) => {
// @ts-ignore
expect(result.unwrap().body).toEqual(JSON.stringify({foo: "bar"}));
expect(result.getEtag()).toEqual("etag-value");
expect(result.getStatusCode()).toEqual(201);
done();
}, () => {
done.fail("should have passed");
});
});
示例2: it
it("should create ApiResult from a successful POST request with 202 response", (done) => {
mockSuccessfulCreateRequestWithAcceptedResponse();
ApiRequestBuilder.POST("/foo", ApiVersion.v1).then((result) => {
// @ts-ignore
expect(result.getRedirectUrl()).toEqual("/go/admin/foo");
expect(result.getRetryAfterIntervalInMillis()).toEqual(10000);
expect(result.getStatusCode()).toEqual(202);
done();
}, () => {
done.fail("should have passed");
});
});