Skip to content

Request Query method replaced by Request Method warning. Result in 500 status code #26

@chrisnaadhi

Description

@chrisnaadhi

Bug description

500

Error: request.query has been replaced by request.url.searchParams
seems like the hooks doesn't need validation because when i'm delete the if validation, it works normal
Screenshot 2022-01-24 151017

work flawlessly and has the same result to delete items :
Screenshot 2022-01-24 151927

Steps to reproduce

Create handle hooks in new kit package with validation :

if (request.query.has("_method")) {
    request.method = request.query.get("_method").toUpperCase();
}

got 500 status code
Screenshot 2022-01-24 151051

Expected behavior

work normal even if with validation :

import type { Handle } from "@sveltejs/kit";

export const handle: Handle = async ({ request, resolve }) => {
  if (request.query.has("_method")) {
    request.method = request.query.get("_method").toUpperCase();
  }

  const response = await resolve(request);
  return response;
};

Example repository

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions