Skip to content

test: cover empty redirect and not-modified responses - #265

Merged
Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
Shubham-Padkonde:test/empty-redirect-responses
Sep 21, 2026
Merged

Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
Shubham-Padkonde:test/empty-redirect-responses

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

Closes #163.

Adds the requested coverage for empty 3xx responses without a Location header. A real local HTTP server returns 302 or 304, and the tests exercise model, model collection, enum, enum collection, primitive, primitive collection, byte and no-content requests. Each must complete without an error and return nil where applicable.

Current main already handles these responses correctly, so this changes tests only. This follows the review guidance on the withdrawn #166 to retain the existing status-code condition and cover the scenario through the request adapter.

Validation on Linux with Go 1.26.3:

  • All 16 new cases pass.
  • Temporarily changing throwIfFailedResponse to reject statuses >= 300 makes all 16 cases fail with ApiError; the production file was restored byte-for-byte before final validation.
  • go test -race ./..., go vet ./..., and go build ./... pass.

No live Microsoft Graph calls or other OS/toolchain tests were run. This contribution and its validation were prepared with OpenAI Codex assistance; no independent human review is claimed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The changes add focused regression coverage with no unresolved review issues.

Review effort: Lite
Findings: None

What changed in this PR

Adds regression tests for empty 302 and 304 responses without Location headers across request adapter methods.

Changes:

  • Adds local HTTP server coverage for 302 and 304 responses.
  • Covers model, collection, enum, primitive, byte, and no-content requests.
File Description
nethttp_request_adapter_redirect_test.go Adds comprehensive empty redirect and not-modified response tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@baywet
Vincent Biret (baywet) merged commit 5f084ae into microsoft:main Sep 21, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

ensure 3XX responses without location header do not throw

3 participants