405 Method Not Allowed: [no body]. But actually it is the right method #12845

Closed
opened 2025-11-02 10:22:42 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Gitttttttt on GitHub (Apr 15, 2024).

Description

When I use POST to request the /admin/users interface:
image

a 405 error is reported:405 Method Not Allowed: [no body].

What else, the request was send by RestTemplate, like this(the param(RequestBody) is not null):
restTemplate.exchange( url, HttpMethod.POST, getEntity(token, param), typeReference );

The server logs:
2024/04/15 15:33:41 ...eb/routing/logger.go:102:func1() [I] router: completed POST /admin/users for 172.16.60.93:61303, 405 Method Not Allowed in 0.4ms @ web/goget.go:20(web.goGet)

Is this a bug or else? Thanks for help.

Gitea Version

1.21.7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

None

Originally created by @Gitttttttt on GitHub (Apr 15, 2024). ### Description When I use POST to request the `/admin/users` interface: ![image](https://github.com/go-gitea/gitea/assets/38375081/99664bb3-ee91-45eb-ae28-72a03cc96b7a) a 405 error is reported:`405 Method Not Allowed: [no body]`. What else, the request was send by `RestTemplate`, like this(the param(RequestBody) is not null): `restTemplate.exchange( url, HttpMethod.POST, getEntity(token, param), typeReference );` The server logs: `2024/04/15 15:33:41 ...eb/routing/logger.go:102:func1() [I] router: completed POST /admin/users for 172.16.60.93:61303, 405 Method Not Allowed in 0.4ms @ web/goget.go:20(web.goGet)` Is this a bug or else? Thanks for help. ### Gitea Version 1.21.7 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? docker ### Database None
GiteaMirror added the issue/needs-feedbackissue/not-a-bug labels 2025-11-02 10:22:42 -06:00
Author
Owner

@yp05327 commented on GitHub (Apr 16, 2024):

URL is not correct. It should have /api/v1/

you can check the samples in docs:
https://docs.gitea.com/development/api-usage

@yp05327 commented on GitHub (Apr 16, 2024): URL is not correct. It should have `/api/v1/` you can check the samples in docs: https://docs.gitea.com/development/api-usage
Author
Owner

@Gitttttttt commented on GitHub (Apr 16, 2024):

Oh it's my fault, I should pay more attention to it.

@Gitttttttt commented on GitHub (Apr 16, 2024): Oh it's my fault, I should pay more attention to it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12845