update got POST requests
This commit is contained in:
Родитель
5b9487589c
Коммит
24a0c5954c
|
@ -22,8 +22,7 @@ const Basket = {
|
|||
const url = `${AppConstants.BASKET_URL}/news/subscribe/`;
|
||||
const reqOptions = {
|
||||
method: "POST",
|
||||
form: true,
|
||||
body: params,
|
||||
form: params,
|
||||
};
|
||||
|
||||
try {
|
||||
|
|
2
hibp.js
2
hibp.js
|
@ -190,7 +190,7 @@ const HIBP = {
|
|||
const path = "/range/subscribe";
|
||||
const options = {
|
||||
method: "POST",
|
||||
body: {hashPrefix: sha1Prefix},
|
||||
json: {hashPrefix: sha1Prefix},
|
||||
};
|
||||
|
||||
return await this.kAnonReq(path, options);
|
||||
|
|
|
@ -28,19 +28,17 @@ const RemoteSettings = {
|
|||
async postNewBreachToBreachesCollection(data) {
|
||||
// Create the record
|
||||
return await got.post(FX_RS_RECORDS, {
|
||||
json: true,
|
||||
username: FX_RS_WRITER_USER,
|
||||
password: FX_RS_WRITER_PASS,
|
||||
body: { data },
|
||||
json: { data },
|
||||
});
|
||||
},
|
||||
|
||||
async requestReviewOnBreachesCollection() {
|
||||
return await got.patch(FX_RS_COLLECTION, {
|
||||
json: true,
|
||||
username: FX_RS_WRITER_USER,
|
||||
password: FX_RS_WRITER_PASS,
|
||||
body: { data: {status: "to-review"} },
|
||||
json: { data: {status: "to-review"} },
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ test("subscribe calls got with expected url and options", async () => {
|
|||
const gotCallArgs = gotCalls[0];
|
||||
expect(gotCallArgs[0]).toBe(`${AppConstants.BASKET_URL}/news/subscribe/`);
|
||||
expect(gotCallArgs[1].method).toBe("POST");
|
||||
const reqBody = gotCallArgs[1].body;
|
||||
const reqBody = gotCallArgs[1].form;
|
||||
expect(reqBody.email).toEqual(testEmail);
|
||||
expect(reqBody.optin).toEqual("Y");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче