Skip to content

Commit

Permalink
fix(handler): proper user-agent pointing to null
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkaroid committed Mar 28, 2023
1 parent 747cacb commit a5fb19f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gaebolg",
"version": "6.1.0-alpha.nightly",
"version": "6.1.1-alpha.nightly",
"main": "index.js",
"author": "sinkaroid",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { iParams, valid_type,
export async function handler(
event: APIGatewayEvent) {

const userAgent = event.multiValueHeaders["user-agent"] ? event.multiValueHeaders["user-agent"][0] : "no user agent";
const userAgent = event.multiValueHeaders["user-agent"] ? event.multiValueHeaders["user-agent"][0] : null;
const gateway = { specs: event.queryStringParameters as unknown as iParams };

if (!valid_type.includes(gateway.specs.type)) return errorNoParams(userAgent);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { valid_image_hentai, valid_image_porn, valid_image_nasuverse } from "../
import { version, name } from "../../package.json";


export async function errorNoParams(ua: string) {
export async function errorNoParams(ua: string | null) {
return {
statusCode: 400,
body: JSON.stringify({
Expand Down Expand Up @@ -56,7 +56,7 @@ export async function maybeError(genre: string) {
};
}

export async function successDelivered(url: string, userAgent: string) {
export async function successDelivered(url: string, userAgent: string | null) {
return {
statusCode: 200,
headers: {
Expand Down

0 comments on commit a5fb19f

Please sign in to comment.