@@ -379,6 +379,21 @@ class KotlinGeneratorTest {
379
379
assertEquals(testOperationId, firstPair.second as String )
380
380
}
381
381
382
+ @Test
383
+ fun processTopLevelHeaders_withOperationIdAndHeadersToIgnore_hasNoHeaders () {
384
+ val testOperationId = " aTestOperationId"
385
+ val generator = KotlinGenerator ()
386
+ val operation = CodegenOperation ()
387
+ generator.additionalProperties()[HEADERS_TO_IGNORE ] = HEADER_X_OPERATION_ID
388
+ operation.vendorExtensions = mutableMapOf (X_OPERATION_ID to (testOperationId as Any ))
389
+
390
+ generator.processTopLevelHeaders(operation)
391
+
392
+ assertEquals(false , operation.vendorExtensions[" hasOperationHeaders" ])
393
+ val headerMap = operation.vendorExtensions[" operationHeaders" ] as List <* >
394
+ assertEquals(0 , headerMap.size)
395
+ }
396
+
382
397
@Test
383
398
fun processTopLevelHeaders_withConsumes_hasContentTypeHeader () {
384
399
val generator = KotlinGenerator ()
@@ -398,6 +413,23 @@ class KotlinGeneratorTest {
398
413
assertEquals(" application/json" , firstPair.second as String )
399
414
}
400
415
416
+ @Test
417
+ fun processTopLevelHeaders_withConsumesAndHeadersToIgnore_hasNoContentTypeHeader () {
418
+ val generator = KotlinGenerator ()
419
+ val operation = CodegenOperation ()
420
+ generator.additionalProperties()[HEADERS_TO_IGNORE ] = HEADER_CONTENT_TYPE
421
+ operation.vendorExtensions = mutableMapOf ()
422
+ operation.consumes = listOf (
423
+ mapOf (" mediaType" to " application/json" )
424
+ )
425
+
426
+ generator.processTopLevelHeaders(operation)
427
+
428
+ assertEquals(false , operation.vendorExtensions[" hasOperationHeaders" ])
429
+ val headerMap = operation.vendorExtensions[" operationHeaders" ] as List <* >
430
+ assertEquals(0 , headerMap.size)
431
+ }
432
+
401
433
@Test
402
434
fun processTopLevelHeaders_withFormParams_hasNoContentTypeHeader () {
403
435
val generator = KotlinGenerator ()
0 commit comments