@@ -536,6 +536,42 @@ class ClientGeneratorTest {
536536 assertFalse(body.contains(" submitForm" ), " Should NOT contain submitForm for JSON" )
537537 }
538538
539+ // -- No body: endpoint without requestBody should not emit setBody or contentType --
540+
541+ @Test
542+ fun `endpoint without requestBody does not generate body null check` () {
543+ val ep = endpoint(
544+ method = HttpMethod .GET ,
545+ operationId = " listPets" ,
546+ requestBody = null ,
547+ )
548+ val cls = clientClass(ep)
549+ val funSpec = cls.funSpecs.first { it.name == " listPets" }
550+ val body = funSpec.body.toString()
551+ assertFalse(body.contains(" setBody" ), " Should NOT contain setBody when no requestBody" )
552+ assertFalse(body.contains(" contentType" ), " Should NOT set contentType when no requestBody" )
553+ assertFalse(body.contains(" if (body" ), " Should NOT check body != null when no requestBody" )
554+ }
555+
556+ // -- URL interpolation: baseUrl must be interpolated, not literal --
557+
558+ @Test
559+ fun `generated URL interpolates baseUrl property` () {
560+ val ep = endpoint(
561+ path = " /pets/{petId}" ,
562+ operationId = " getPet" ,
563+ parameters = listOf (
564+ Parameter (" petId" , ParameterLocation .PATH , true , TypeRef .Primitive (PrimitiveType .LONG ), null ),
565+ ),
566+ )
567+ val cls = clientClass(ep)
568+ val funSpec = cls.funSpecs.first { it.name == " getPet" }
569+ val body = funSpec.body.toString()
570+ // Must contain ${baseUrl} as interpolation, not ${'$'}{baseUrl} (escaped/literal)
571+ assertTrue(body.contains(" \$ {baseUrl}" ), " Expected \$ {baseUrl} interpolation in URL" )
572+ assertFalse(body.contains(" \$ {'$'}{baseUrl}" ), " baseUrl must not be escaped as literal text" )
573+ }
574+
539575 // -- CONT-02: Form-urlencoded code generation --
540576
541577 @Test
0 commit comments