Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

feat: serve response headers declared in the spec

Chiusa
#87 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 17 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
67/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
kotlin, openapi
Ambito
api, testing-qa

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

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.json format 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>.headers object — prefer that over inventing a new mechanism, since it's already a standard field this parser will otherwise ignore.
  • Thread declared headers through MockResponse and into createMockHttpClientCall's headersOf(...) call, merging with (not replacing) the existing Content-Type default 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-Type still defaults to application/json when a mock doesn't declare it explicitly.

Files likely touched

  • devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt
  • devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/model/MockResponse.kt
  • devview-networkmock-ktor/src/androidHostTest/.../NetworkMockPluginTest.kt
Lingua principale
Kotlin
Stelle
11
Fork
3
Merge medio
10g 9h
PR unite (30g)
18

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di worldline/devview

Tutte le issue di worldline/devview

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.