-
Notifications
You must be signed in to change notification settings - Fork 5
Add reply draft creation and deletion operations #57
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
Open
jr-lillard
wants to merge
11
commits into
basecamp:main
Choose a base branch
from
jr-lillard:feat/reply-drafts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
977ea4d
Fix addressed fields to use comma-separated strings instead of arrays
cpinto d312959
Model browser-compatible reply draft operations
jr-lillard 77e58df
Add reply draft service operations
jr-lillard 8ba649b
Address reply draft review findings
jr-lillard 317d723
Reject blank route exclusion reasons
jr-lillard 7327228
Harden review validation paths
jr-lillard c6e9e7a
Clarify custom redirect doer behavior
jr-lillard 16eb828
Preserve generated HTTP client identity
jr-lillard 804044f
Handle draft edit locations
jr-lillard 2ed18b9
Strip empty draft Location queries
jr-lillard 66c3588
Validate reply draft Location routes
jr-lillard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "errors" | ||
| "io" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestReadRequestBodyPropagatesPartialReadError(t *testing.T) { | ||
| sentinel := errors.New("request body read failed") | ||
| reader := &partialErrorReadCloser{ | ||
| contents: []byte("status=drafted"), | ||
| err: sentinel, | ||
| } | ||
|
|
||
| body, err := readRequestBody(reader) | ||
| if !errors.Is(err, sentinel) { | ||
| t.Fatalf("readRequestBody() error = %v, want %v", err, sentinel) | ||
| } | ||
| if got, want := string(body), "status=drafted"; got != want { | ||
| t.Fatalf("readRequestBody() body = %q, want %q", got, want) | ||
| } | ||
| if !reader.closed { | ||
| t.Fatal("readRequestBody() did not close the request body") | ||
| } | ||
| } | ||
|
|
||
| func TestReadRequestBodyPropagatesCloseError(t *testing.T) { | ||
| sentinel := errors.New("request body close failed") | ||
| reader := &partialErrorReadCloser{ | ||
| contents: []byte("status=drafted"), | ||
| closeErr: sentinel, | ||
| } | ||
|
|
||
| body, err := readRequestBody(reader) | ||
| if !errors.Is(err, sentinel) { | ||
| t.Fatalf("readRequestBody() error = %v, want %v", err, sentinel) | ||
| } | ||
| if got, want := string(body), "status=drafted"; got != want { | ||
| t.Fatalf("readRequestBody() body = %q, want %q", got, want) | ||
| } | ||
| } | ||
|
|
||
| type partialErrorReadCloser struct { | ||
| contents []byte | ||
| err error | ||
| closeErr error | ||
| read bool | ||
| closed bool | ||
| } | ||
|
|
||
| func (r *partialErrorReadCloser) Read(p []byte) (int, error) { | ||
| if r.read { | ||
| return 0, io.EOF | ||
| } | ||
| r.read = true | ||
| return copy(p, r.contents), r.err | ||
| } | ||
|
|
||
| func (r *partialErrorReadCloser) Close() error { | ||
| r.closed = true | ||
| return r.closeErr | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| [ | ||
| { | ||
| "name": "DeleteDraft uses the browser discard form without following redirects", | ||
| "description": "Verifies the Rails method override, drafted guard, CSRF header, redirect preservation, and single-attempt browser form transport", | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
| "operation": "DeleteDraft", | ||
| "method": "POST", | ||
| "path": "/messages/{messageId}", | ||
| "pathParams": {"messageId": 987}, | ||
| "requestBody": { | ||
| "authenticity_token": "conformance-delete-csrf" | ||
| }, | ||
| "mockResponses": [ | ||
| { | ||
| "status": 303, | ||
| "headers": {"Location": "/topics/123"} | ||
| } | ||
| ], | ||
| "assertions": [ | ||
| {"type": "requestCount", "expected": 1}, | ||
| {"type": "requestPath", "expected": "/messages/987"}, | ||
| {"type": "requestHeader", "path": "Content-Type", "expected": "application/x-www-form-urlencoded"}, | ||
| {"type": "requestHeader", "path": "X-CSRF-Token", "expected": "conformance-delete-csrf"}, | ||
| {"type": "requestForm", "path": "_method", "expected": "delete"}, | ||
| {"type": "requestForm", "path": "status", "expected": "drafted"}, | ||
| {"type": "responseHeader", "path": "Location", "expected": "/topics/123"}, | ||
| {"type": "statusCode", "expected": 303}, | ||
| {"type": "noError"} | ||
| ], | ||
| "tags": ["entries", "drafts", "delete", "form", "csrf"] | ||
| } | ||
| ] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.