Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #175 from zalando/#174-Content-type-not-supported-…
Browse files Browse the repository at this point in the history
…code

#174, refactor: Changed response code for wrong content type
  • Loading branch information
slavaschmidt authored Jul 7, 2016
2 parents ce87dcc + cca593f commit ffe58dc
Show file tree
Hide file tree
Showing 19 changed files with 132 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ trait {{controller.base}} extends Controller with PlayBodyParsing {{if controlle
{{if m.form_parameters}}
}
{{/if}}
}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def {{m.process_valid_request}}[T](f: {{m.action_type}}[T])(request: {{m.action_request_type}})(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ trait BasicAuthApiYamlBase extends Controller with PlayBodyParsing with BasicAu
val result = processValidgetRequest(f)()(getResponseMimeType)
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetRequest[T](f: getActionType[T])(request: getActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ trait Cross_spec_referencesYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidpostRequest[T](f: postActionType[T])(request: postActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ trait EchoHandlerBase extends Controller with PlayBodyParsing {
val result = processValidmethodRequest(f)()(methodResponseMimeType)
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidmethodRequest[T](f: methodActionType[T])(request: methodActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -89,7 +89,7 @@ trait EchoApiYamlBase extends Controller with PlayBodyParsing {

}

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidpostRequest[T](f: postActionType[T])(request: postActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -124,7 +124,7 @@ trait EchoApiYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgettest_pathByIdRequest[T](f: gettest_pathByIdActionType[T])(request: gettest_pathByIdActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ trait Error_in_arrayYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetschemaModelRequest[T](f: getschemaModelActionType[T])(request: getschemaModelActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ trait Expanded_polymorphismYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidfindPetsRequest[T](f: findPetsActionType[T])(request: findPetsActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -98,7 +98,7 @@ trait Expanded_polymorphismYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidaddPetRequest[T](f: addPetActionType[T])(request: addPetActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -134,7 +134,7 @@ trait Expanded_polymorphismYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValiddeletePetRequest[T](f: deletePetActionType[T])(request: deletePetActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ trait Form_dataYamlBase extends Controller with PlayBodyParsing {

}

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidpostmultipartRequest[T](f: postmultipartActionType[T])(request: postmultipartActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -102,7 +102,7 @@ trait Form_dataYamlBase extends Controller with PlayBodyParsing {

}

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidposturl_encodedRequest[T](f: posturl_encodedActionType[T])(request: posturl_encodedActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -146,7 +146,7 @@ trait Form_dataYamlBase extends Controller with PlayBodyParsing {

}

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidpostbothRequest[T](f: postbothActionType[T])(request: postbothActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidfindPetsByTagsRequest[T](f: findPetsByTagsActionType[T])(request: findPetsByTagsActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -102,7 +102,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidplaceOrderRequest[T](f: placeOrderActionType[T])(request: placeOrderActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -152,7 +152,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidcreateUserRequest[T](f: createUserActionType[T])(request: createUserActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -202,7 +202,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidcreateUsersWithListInputRequest[T](f: createUsersWithListInputActionType[T])(request: createUsersWithListInputActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -242,7 +242,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetUserByNameRequest[T](f: getUserByNameActionType[T])(request: getUserByNameActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -296,7 +296,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidupdateUserRequest[T](f: updateUserActionType[T])(request: updateUserActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -335,7 +335,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValiddeleteUserRequest[T](f: deleteUserActionType[T])(request: deleteUserActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -390,7 +390,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidupdatePetRequest[T](f: updatePetActionType[T])(request: updatePetActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -441,7 +441,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidaddPetRequest[T](f: addPetActionType[T])(request: addPetActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -491,7 +491,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidcreateUsersWithArrayInputRequest[T](f: createUsersWithArrayInputActionType[T])(request: createUsersWithArrayInputActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -531,7 +531,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetOrderByIdRequest[T](f: getOrderByIdActionType[T])(request: getOrderByIdActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -570,7 +570,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValiddeleteOrderRequest[T](f: deleteOrderActionType[T])(request: deleteOrderActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -599,7 +599,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
val result = processValidlogoutUserRequest(f)()(logoutUserResponseMimeType)
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidlogoutUserRequest[T](f: logoutUserActionType[T])(request: logoutUserActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -639,7 +639,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetPetByIdRequest[T](f: getPetByIdActionType[T])(request: getPetByIdActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -686,7 +686,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full

}

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidupdatePetWithFormRequest[T](f: updatePetWithFormActionType[T])(request: updatePetWithFormActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -734,7 +734,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
BadRequest(msg)
}

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValiddeletePetRequest[T](f: deletePetActionType[T])(request: deletePetActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -772,7 +772,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidfindPetsByStatusRequest[T](f: findPetsByStatusActionType[T])(request: findPetsByStatusActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -810,7 +810,7 @@ trait FullPetstoreApiYamlBase extends Controller with PlayBodyParsing with Full
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidloginUserRequest[T](f: loginUserActionType[T])(request: loginUserActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ trait HackweekYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetschemaModelRequest[T](f: getschemaModelActionType[T])(request: getschemaModelActionRequestType)(mimeType: String) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trait HerokuPetstoreApiYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetRequest[T](f: getActionType[T])(request: getActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -93,7 +93,7 @@ trait HerokuPetstoreApiYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidputRequest[T](f: putActionType[T])(request: putActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -142,7 +142,7 @@ trait HerokuPetstoreApiYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidpostRequest[T](f: postActionType[T])(request: postActionRequestType)(mimeType: String) = {
Expand Down Expand Up @@ -177,7 +177,7 @@ trait HerokuPetstoreApiYamlBase extends Controller with PlayBodyParsing {
}
result

}.getOrElse(Status(415)("The server doesn't support any of the requested mime types"))
}.getOrElse(Status(406)("The server doesn't support any of the requested mime types"))
}

private def processValidgetbyPetIdRequest[T](f: getbyPetIdActionType[T])(request: getbyPetIdActionRequestType)(mimeType: String) = {
Expand Down
Loading

0 comments on commit ffe58dc

Please sign in to comment.