Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: custom endpoints with method: 'put' #9037

Merged
merged 1 commit into from
Nov 5, 2024
Merged

fix: custom endpoints with method: 'put' #9037

merged 1 commit into from
Nov 5, 2024

Conversation

r1tsuu
Copy link
Member

@r1tsuu r1tsuu commented Nov 5, 2024

What?

Fixes support for custom endpoints with method: 'put'.
Previously, this didn't work:

export default buildConfigWithDefaults({
  collections: [ ],
  endpoints: [
    {
      method: 'put',
      handler: () => new Response(),
      path: '/put',
    },
  ],
})

Why?

We supported this in 2.0 and docs are saying that we can use 'put' as method https://payloadcms.com/docs/beta/rest-api/overview#custom-endpoints

How?

Implements the REST_PUT export for @payloadcms/next/routes, updates all templates. Additionally, adds tests to ensure root/collection level custom endpoints with all necessary methods execute properly.

Fixes #8807

-->

@r1tsuu r1tsuu merged commit 9ce2ba6 into beta Nov 5, 2024
57 checks passed
@r1tsuu r1tsuu deleted the fix/put-endpoints branch November 5, 2024 21:14
Copy link

github-actions bot commented Nov 6, 2024

🚀 This is included in version v3.0.0-beta.125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Endpoint PUT request gives 405 Method not allowed
2 participants