Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/adapter/aws-lambda/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
return result
}

setCookies(event: E, res: Response, result: APIGatewayProxyResult) {

Check failure on line 374 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Main

'event' is declared but its value is never read.

Check failure on line 374 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / workerd

'event' is declared but its value is never read.

Check failure on line 374 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v18.18.2

'event' is declared but its value is never read.

Check failure on line 374 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v22.x

'event' is declared but its value is never read.

Check failure on line 374 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v20.x

'event' is declared but its value is never read.
if (res.headers.has('set-cookie')) {
const cookies = res.headers.getSetCookie
? res.headers.getSetCookie()
Expand Down Expand Up @@ -413,17 +413,20 @@
protected getHeaders(event: APIGatewayProxyEventV2): Headers {
const headers = new Headers()
this.getCookies(event, headers)
if (event.headers) {
for (const [k, v] of Object.entries(event.headers)) {
if (v) {
headers.set(k, v)
const eventHeaders = event.headers
if (eventHeaders) {
for (const k in eventHeaders) {
if (Object.prototype.hasOwnProperty.call(eventHeaders, k)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking hasOwnProperty is really necessary? I think the eventHandlers is a plain object ({}), so it's unnecessary. What do you think of it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for...in also enumerates properties in the prototype chain. Object.keys() doesn't, so you can skip hasOwnProperty

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fcarvajalbrown Can you handle this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sorry i will, been busy with work on the weekends but now i am available! cheers!

const v = eventHeaders[k]
if (v) {
headers.set(k, v)
}
}
}
}
return headers
}
}

const v2Processor: EventV2Processor = new EventV2Processor()

export class EventV1Processor extends EventProcessor<APIGatewayProxyEvent> {
Expand Down Expand Up @@ -455,9 +458,9 @@

protected getCookies(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
event: APIGatewayProxyEvent,

Check failure on line 461 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Main

'event' is declared but its value is never read.

Check failure on line 461 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / workerd

'event' is declared but its value is never read.

Check failure on line 461 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v18.18.2

'event' is declared but its value is never read.

Check failure on line 461 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v22.x

'event' is declared but its value is never read.

Check failure on line 461 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v20.x

'event' is declared but its value is never read.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
headers: Headers

Check failure on line 463 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Main

'headers' is declared but its value is never read.

Check failure on line 463 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / workerd

'headers' is declared but its value is never read.

Check failure on line 463 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v18.18.2

'headers' is declared but its value is never read.

Check failure on line 463 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v22.x

'headers' is declared but its value is never read.

Check failure on line 463 in src/adapter/aws-lambda/handler.ts

View workflow job for this annotation

GitHub Actions / Node.js v20.x

'headers' is declared but its value is never read.
): void {
// nop
}
Expand Down
Loading