Skip to content

Commit

Permalink
fix(logging): change error to warn (#801)
Browse files Browse the repository at this point in the history
* fix(logging): change error to warn

* tests: adapt for changes

Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
  • Loading branch information
wolfy1339 and gr2m authored Jan 14, 2023
1 parent 60a3102 commit f25154a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Webhooks<TTransformed = unknown> {
this.sign = sign.bind(null, options.secret);
this.verify = (eventPayload: object | string, signature: string) => {
if (typeof eventPayload === "object") {
console.error(
console.warn(
"[@octokit/webhooks] Passing a JSON payload object to `verify()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`"
);
}
Expand All @@ -79,7 +79,7 @@ class Webhooks<TTransformed = unknown> {
| EmitterWebhookEventWithSignature
) => {
if (typeof options.payload === "object") {
console.error(
console.warn(
"[@octokit/webhooks] Passing a JSON payload object to `verifyAndReceive()` is deprecated and the functionality will be removed in a future release of `@octokit/webhooks`"
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/node/get-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function getPayload(

if (request.body) {
if (typeof request.body !== "string") {
console.error(
console.warn(
"[@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."
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function createNodeMiddleware(
}: MiddlewareOptions = {}
) {
const deprecateOnUnhandledRequest = (request: any, response: any) => {
console.error(
console.warn(
"[@octokit/webhooks] `onUnhandledRequest()` is deprecated and will be removed in a future release of `@octokit/webhooks`"
);
return onUnhandledRequest(request, response);
Expand Down
6 changes: 3 additions & 3 deletions test/unit/deprecation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Deprecations", () => {
);
});
test("onUnhandledRequest", async () => {
const spy = jest.spyOn(console, "error");
const spy = jest.spyOn(console, "warn");
const webhooks = new Webhooks({
secret: "mySecret",
});
Expand Down Expand Up @@ -54,7 +54,7 @@ describe("Deprecations", () => {
});

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

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

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

Expand Down

0 comments on commit f25154a

Please sign in to comment.