full-stack-web-development icon indicating copy to clipboard operation
full-stack-web-development copied to clipboard

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

Open chrisnaadhi opened this issue 3 years ago • 1 comments

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

chrisnaadhi avatar Jan 24 '22 08:01 chrisnaadhi

this has to do with this sveltekit PR? https://github.com/sveltejs/kit/pull/3384

oneezy avatar Jan 26 '22 23:01 oneezy