oauthex: accept 200 in client registration (#877)
## Summary Accepts HTTP 200 as a valid response in Dynamic Client Registration (DCR), in addition to 201. Some authorization servers return 200 instead of the RFC-specified 201 on successful registration. Fixes https://github.com/modelcontextprotocol/go-sdk/issues/876 ## Changes - `oauthex/dcr.go`: accept 200 status code in client registration response - `oauthex/dcr_test.go`: add test coverage for the 200 response case
This commit is contained in:
parent
6537610f47
commit
76d5a54125
1 changed files with 25 additions and 1 deletions
|
|
@ -204,7 +204,7 @@ func RegisterClient(ctx context.Context, registrationEndpoint string, clientMeta
|
|||
return nil, fmt.Errorf("failed to read registration response body: %w", err)
|
||||
}
|
||||
|
||||
if resp.StatusCode == http.StatusCreated {
|
||||
if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusOK {
|
||||
var regResponse ClientRegistrationResponse
|
||||
if err := internaljson.Unmarshal(body, ®Response); err != nil {
|
||||
return nil, fmt.Errorf("failed to decode successful registration response: %w (%s)", err, string(body))
|
||||
|
|
|
|||
Loading…
Reference in a new issue