Skip to content

Conversation

@slinkydeveloper
Copy link

Fix #225

@cjbooms
Copy link
Collaborator

cjbooms commented Jul 26, 2023

Open to fixing this, but won't be back from vacation until next week. If you want it urgently, please update one of the test cases with example openapi spec for this and generated code

"toMediaType".toClassName("okhttp3.MediaType.Companion")
)
} ?: this.add("\n.%N(ByteArray(0).%T())", verb, toRequestBody)
} ?: if (verb == "delete") this.add("\n.delete()") else this.add("\n.%N(ByteArray(0).%T())", verb, toRequestBody)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems out of place. I suggest checking to see if a delete verb has any Body parameters in addRequestStatement.

"HEAD" -> this.add("\n.head()")
"GET" -> this.add("\n.get()")
"DELETE" -> this.add("\n.delete()")
"DELETE" -> this.addRequestSerializerStatement("delete")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't cloned the repo yet, but on first light, I think something like this would be a more cohesive solution.

"DELETE" -> {
  val hasBodyParameters = parameters.any { it is BodyParameter }
  if (hasBodyParameters) {
      this.addRequestSerializerStatement("delete")
  } else {
       this.add("\n.delete()")
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DELETE doesn't propagate the body

3 participants