-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1686 from abrighton/master
Added support for HTTP HEAD method for akka-http and http4s
- Loading branch information
Showing
4 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
modules/scala-akka-http/src/test/scala/core/issues/Issue1682.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package core.issues | ||
|
||
import dev.guardrail.generators.scala.ScalaGeneratorMappings.scalaInterpreter | ||
import dev.guardrail.Context | ||
import support.SwaggerSpecRunner | ||
import org.scalatest.funsuite.AnyFunSuite | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
class Issue1682 extends AnyFunSuite with Matchers with SwaggerSpecRunner { | ||
|
||
val swagger: String = s""" | ||
|swagger: '2.0' | ||
|host: petstore.swagger.io | ||
|paths: | ||
| "/pet/{petId}": | ||
| head: | ||
| operationId: test1682 | ||
| tags: | ||
| - pet | ||
| parameters: | ||
| - name: petId | ||
| in: path | ||
| description: ID of pet that needs to be fetched | ||
| required: true | ||
| type: string | ||
| responses: | ||
| '400': | ||
| description: Invalid ID supplied | ||
| '404': | ||
| description: Pet not found | ||
|""".stripMargin | ||
|
||
test("Support for HTTP HEAD method") { | ||
runSwaggerSpec(scalaInterpreter)(swagger)(Context.empty, "akka-http") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
modules/scala-http4s/src/test/scala/core/issues/Issue1682.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package core.issues | ||
|
||
import org.scalatest.funsuite.AnyFunSuite | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
import support.SwaggerSpecRunner | ||
|
||
import dev.guardrail._ | ||
import dev.guardrail.generators.scala.ScalaGeneratorMappings.scalaInterpreter | ||
import dev.guardrail.generators.scala.http4s.Http4sVersion | ||
|
||
class Issue1682 extends AnyFunSuite with Matchers with SwaggerSpecRunner { | ||
|
||
val swagger: String = s""" | ||
|swagger: '2.0' | ||
|host: petstore.swagger.io | ||
|paths: | ||
| "/pet/{petId}": | ||
| head: | ||
| operationId: test1682 | ||
| tags: | ||
| - pet | ||
| parameters: | ||
| - name: petId | ||
| in: path | ||
| description: ID of pet that needs to be fetched | ||
| required: true | ||
| type: string | ||
| responses: | ||
| '400': | ||
| description: Invalid ID supplied | ||
| '404': | ||
| description: Pet not found | ||
|""".stripMargin | ||
|
||
def testVersion(version: Http4sVersion): Unit = | ||
test(s"$version - Test HTTP HEAD support") { | ||
runSwaggerSpec(scalaInterpreter)(swagger)(Context.empty, version.value) | ||
} | ||
|
||
testVersion(Http4sVersion.V0_22) | ||
testVersion(Http4sVersion.V0_23) | ||
} |