feat: serve response headers declared in the spec
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 67/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- kotlin, openapi
- Domain
- api, testing-qa
Research direction
First check the status of the OpenAPI migration in epic #72/#1. Then inspect MockResponse.kt and createMockHttpClientCall in NetworkMockPlugin.kt, followed by the existing assertions in NetworkMockPluginTest.kt. Done means declared response headers reach the app, while Content-Type still defaults to application/json unless explicitly overridden.
Written by the indexing model from the issue text.
Description
Summary
Mocked HTTP responses returned by NetworkMockPlugin always carry only a Content-Type: application/json header, with no way to declare additional headers per mock. This is independent of the OpenAPI migration (tracked in the epic, #72) and can be picked up any time — though if the OpenAPI migration (#1) has already landed, this becomes a natural fit for OpenAPI's responses.<code>.headers field, so check the epic's status before starting.
Current state
createMockHttpClientCall (devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt:322-346) builds the synthetic HttpResponseData with a hardcoded single header:
headers = headersOf(
name = HttpHeaders.ContentType,
value = ContentType.Application.Json.toString()
),
(:332-335). There is no mechanism anywhere in MockResponse (devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/MockResponse.kt:79-84) or the config format to declare additional response headers (auth challenge headers, caching headers, custom headers a client depends on, etc.) for a mocked response.
What to build
- If done before the OpenAPI migration lands: extend the current
mocks.jsonformat with an optional headers field per endpoint/response. - If done after the OpenAPI migration (#1) lands: this maps naturally onto OpenAPI's standard
responses.<code>.headersobject — prefer that over inventing a new mechanism, since it's already a standard field this parser will otherwise ignore. - Thread declared headers through
MockResponseand intocreateMockHttpClientCall'sheadersOf(...)call, merging with (not replacing) the existingContent-Typedefault unless a mock explicitly overrides it.
Acceptance criteria
- A mocked response can declare headers beyond
Content-Type. - Declared headers appear on the response the app actually receives (add a Ktor plugin test asserting header presence, alongside the existing status/body assertions in
NetworkMockPluginTest.kt). -
Content-Typestill defaults toapplication/jsonwhen a mock doesn't declare it explicitly.
Files likely touched
devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.ktdevview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/MockResponse.ktdevview-networkmock-ktor/src/androidHostTest/.../NetworkMockPluginTest.kt
- Dominant language
- Kotlin
- Stars
- 10
- Forks
- 2
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 13
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from worldline/devview
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
All issues in worldline/devview
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
AAswordman/Operit#1265 · 3 comments ·
-
Source is down
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
keiyoushi/extensions-source#19317 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
acristescu/OnlineGo#216 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
libre-tube/LibreTube#8803 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100