Skip to content

Commit

Permalink
Endrer part-navn for filer til å inkludere filnr
Browse files Browse the repository at this point in the history
  • Loading branch information
HegeErdal committed Jan 24, 2025
1 parent 2fb06d9 commit 892ee85
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,19 @@ class SendKlientV2(
}

private fun MultiPartRequestContent.addDokumenter(forsendelse: Forsendelse, dokumentnavnTilData: Map<String, InputStream>) {
forsendelse.dokumenter?.forEach {
forsendelse.dokumenter?.forEachIndexed { index, dokument ->
addDokument(
dokumentnavn = it.filnavn,
data = dokumentnavnTilData[it.filnavn] ?: throw MissingDataException("Fant ikke input stream for dokument ${it.filnavn}")
dokumentnavn = dokument.filnavn,
data = dokumentnavnTilData[dokument.filnavn] ?: throw MissingDataException("Fant ikke input stream for dokument ${dokument.filnavn}"),
filnr = index
)
}
}

private fun MultiPartRequestContent.addDokument(dokumentnavn: String, data: InputStream) {
private fun MultiPartRequestContent.addDokument(dokumentnavn: String, data: InputStream, filnr: Int) {
addPart(
MultiPart.ContentSourcePart(
FILER_PART_NAME,
"${FILER_PART_NAME}_$filnr",
dokumentnavn,
null,
InputStreamRequestContent(data),
Expand Down

0 comments on commit 892ee85

Please sign in to comment.