-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: add bulk user secret import endpoint and SDK client (PLAT-240) #26724
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
Changes from all commits
7994034
467b822
9627726
f585634
00c98a3
85e34e3
b9e2a41
b220dcf
2a18f87
ea62f71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,6 +239,13 @@ func Read(ctx context.Context, rw http.ResponseWriter, r *http.Request, value in | |
|
|
||
| err := json.NewDecoder(r.Body).Decode(value) | ||
| if err != nil { | ||
| if _, ok := errors.AsType[*http.MaxBytesError](err); ok { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL of this syntax vs |
||
| Write(ctx, rw, http.StatusRequestEntityTooLarge, codersdk.Response{ | ||
| Message: "Request body too large.", | ||
| Detail: err.Error(), | ||
| }) | ||
| return false | ||
| } | ||
| Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ | ||
| Message: "Request body must be valid JSON.", | ||
| Detail: err.Error(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Coder Agents:
FYI for reviewers (not a change request): this teaches the shared
Readhelper to return413on*http.MaxBytesError, which is a strict improvement over the old behavior (an oversized body previously surfaced as400 "Request body must be valid JSON."). Flagging only that it's cross-cutting — the new status now applies to every endpoint that wraps its body inhttp.MaxBytesReader, not just the new batch import. That looks intentional and it's covered by the newTestRead/BodyTooLargecase; noting it so the shared-behavior change is a conscious sign-off rather than an incidental side effect.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, intentional. 413 is the right status for an oversized body, and it only affects endpoints already using http.MaxBytesReader 👍