Skip to content

Commit f25154a

Browse files
wolfy1339gr2m
andauthored
fix(logging): change error to warn (#801)
* fix(logging): change error to warn * tests: adapt for changes Co-authored-by: Gregor Martynus <[email protected]>
1 parent 60a3102 commit f25154a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Webhooks<TTransformed = unknown> {
6262
this.sign = sign.bind(null, options.secret);
6363
this.verify = (eventPayload: object | string, signature: string) => {
6464
if (typeof eventPayload === "object") {
65-
console.error(
65+
console.warn(
6666
"[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`"
6767
);
6868
}
@@ -79,7 +79,7 @@ class Webhooks<TTransformed = unknown> {
7979
| EmitterWebhookEventWithSignature
8080
) => {
8181
if (typeof options.payload === "object") {
82-
console.error(
82+
console.warn(
8383
"[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`"
8484
);
8585
}

src/middleware/node/get-payload.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function getPayload(
2020

2121
if (request.body) {
2222
if (typeof request.body !== "string") {
23-
console.error(
23+
console.warn(
2424
"[@octokit/webhooks] Passing the payload as a JSON object in `request.body` is deprecated and will be removed in a future release of `@octokit/webhooks`, please pass it as a a `string` instead."
2525
);
2626
}

src/middleware/node/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function createNodeMiddleware(
1313
}: MiddlewareOptions = {}
1414
) {
1515
const deprecateOnUnhandledRequest = (request: any, response: any) => {
16-
console.error(
16+
console.warn(
1717
"[@octokit/webhooks] `onUnhandledRequest()` is deprecated and will be removed in a future release of `@octokit/webhooks`"
1818
);
1919
return onUnhandledRequest(request, response);

test/unit/deprecation.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("Deprecations", () => {
1919
);
2020
});
2121
test("onUnhandledRequest", async () => {
22-
const spy = jest.spyOn(console, "error");
22+
const spy = jest.spyOn(console, "warn");
2323
const webhooks = new Webhooks({
2424
secret: "mySecret",
2525
});
@@ -54,7 +54,7 @@ describe("Deprecations", () => {
5454
});
5555

5656
test("webhooks.verify(payload, signature) with object payload", async () => {
57-
const spy = jest.spyOn(console, "error");
57+
const spy = jest.spyOn(console, "warn");
5858
const secret = "mysecret";
5959
const webhooks = new Webhooks({ secret });
6060

@@ -69,7 +69,7 @@ describe("Deprecations", () => {
6969
});
7070

7171
test("webhooks.verifyAndReceive(payload, signature) with object payload", async () => {
72-
const spy = jest.spyOn(console, "error");
72+
const spy = jest.spyOn(console, "warn");
7373
const secret = "mysecret";
7474
const webhooks = new Webhooks({ secret });
7575

0 commit comments

Comments
 (0)