NuxtN
Nuxt2y ago
1 reply
Fisher

useFetch with patch method is making GET requests instead

Hello, I am trying to make a
patch
request to an endpoint on a different server. When making the request, I am getting a
405
on the external server that the
GET
method being sent is not allowed. So it seems that nuxt is not respecting my
patch
parameter as the method. Any ideas how to make a patch request/fix this issue?

const { data: application, refresh } = await useFetch<DeveloperApplicationDto>(`${config.public.abandonAuthUrl}/developer_application/${application_id}`, {
  lazy: true,
  headers: {
    Authorization: `Bearer ${auth.value}`
  }
})

async function submitNewCallbackUris() {
  if (application.value?.callback_uris !== undefined){
    await useFetch(`${config.public.abandonAuthUrl}/developer_application/${application_id}/callback_uris`), {
      method: "PATCH",
      headers: {
        Authorization: `Bearer ${auth.value}`
      },
      body: application.value.callback_uris
    }
    console.log("submitted new uris")
  }
}
Was this page helpful?