Skip to content

feat(http-client-python): add mock API tests for payload/head scenario#10420

Closed
Copilot wants to merge 5 commits into
mainfrom
copilot/add-test-case-for-pull-10194
Closed

feat(http-client-python): add mock API tests for payload/head scenario#10420
Copilot wants to merge 5 commits into
mainfrom
copilot/add-test-case-for-pull-10194

Conversation

Copilot AI commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Adds Python SDK mock API tests for the payload/head Spector scenario introduced in #10194 — a HEAD operation returning Content-Type and x-ms-meta response headers with no body.

Changes

  • package.json — Bumps @typespec/http-specs to 0.1.0-alpha.37 (stable version containing the payload/head spec)
  • mock_api/shared/test_payload_head.py + asynctests/test_payload_head_async.py — Sync and async tests placed in shared/ since both azure and unbranded flavors expose identical import paths and API surface

The tests cover two scenarios:

def test_content_type_header_in_response(client: HeadClient):
    assert client.content_type_header_in_response() is True

def test_content_type_header_in_response_with_cls(client: HeadClient):
    headers = client.content_type_header_in_response(cls=lambda x, y, z: z)
    assert headers["Content-Type"] == "text/plain; charset=utf-8"
    assert headers["x-ms-meta"] == "hello"

The scenario sends a HEAD request to /payload/head/content-type-header-in-response and expects a 200 response with Content-Type: text/plain; charset=utf-8 and x-ms-meta: hello headers. The cls variant verifies that response headers are correctly deserialized and accessible via the callback.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Apr 17, 2026
Copilot AI changed the title [WIP] Add test case for pull request 10194 feat(http-client-python): add mock API tests for payload/head scenario Apr 17, 2026
Copilot AI requested a review from msyyc April 17, 2026 23:00
@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label May 18, 2026
@msyyc

msyyc commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Comment thread packages/http-client-python/eng/scripts/ci/regenerate-common.ts Outdated
# Conflicts:
#	packages/http-client-python/package-lock.json
#	packages/http-client-python/package.json

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved. The conflicts in package.json and package-lock.json have been fixed by taking main's ~0.82.0 versions for @typespec/sse/streams/xml and using the stable @typespec/http-specs@0.1.0-alpha.37 (which already includes the payload/head spec). The branch is now merged with main.

…ce override; add cls header test

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copilot finished work on behalf of msyyc June 4, 2026 09:33
@msyyc msyyc marked this pull request as ready for review June 10, 2026 05:34
@msyyc

msyyc commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	packages/http-client-python/package-lock.json

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved in 119ab0ac. The only conflict was in package-lock.json, which I regenerated from main's base via npm install.

Copilot finished work on behalf of msyyc June 10, 2026 05:38
@msyyc

msyyc commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

move to #10944

@msyyc msyyc closed this Jun 10, 2026
@msyyc msyyc deleted the copilot/add-test-case-for-pull-10194 branch June 10, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python] add test case for https://github.com/microsoft/typespec/pull/10194

2 participants