From ebe3e976df10662c818b19465bd3a6f0856f038d Mon Sep 17 00:00:00 2001 From: Mathias Date: Mon, 30 Sep 2013 14:19:33 +0200 Subject: [PATCH] ! httpx: remove MetaUnmarshallers.scala, fold only member into FormDataUnmarshallers.scala --- .../httpx/unmarshalling/Deserializer.scala | 1 - .../unmarshalling/FormDataUnmarshallers.scala | 11 ++++++ .../unmarshalling/MetaUnmarshallers.scala | 36 ------------------- 3 files changed, 11 insertions(+), 37 deletions(-) delete mode 100644 spray-httpx/src/main/scala/spray/httpx/unmarshalling/MetaUnmarshallers.scala diff --git a/spray-httpx/src/main/scala/spray/httpx/unmarshalling/Deserializer.scala b/spray-httpx/src/main/scala/spray/httpx/unmarshalling/Deserializer.scala index 66b16b57aa..797fa6022b 100644 --- a/spray-httpx/src/main/scala/spray/httpx/unmarshalling/Deserializer.scala +++ b/spray-httpx/src/main/scala/spray/httpx/unmarshalling/Deserializer.scala @@ -31,7 +31,6 @@ trait Deserializer[A, B] extends (A ⇒ Deserialized[B]) { self ⇒ object Deserializer extends DeserializerLowerPriorityImplicits with BasicUnmarshallers - with MetaUnmarshallers with FromStringDeserializers with FormDataUnmarshallers { diff --git a/spray-httpx/src/main/scala/spray/httpx/unmarshalling/FormDataUnmarshallers.scala b/spray-httpx/src/main/scala/spray/httpx/unmarshalling/FormDataUnmarshallers.scala index c5ef236ce8..ba353e6434 100644 --- a/spray-httpx/src/main/scala/spray/httpx/unmarshalling/FormDataUnmarshallers.scala +++ b/spray-httpx/src/main/scala/spray/httpx/unmarshalling/FormDataUnmarshallers.scala @@ -113,6 +113,17 @@ trait FormDataUnmarshallers { throw new IllegalArgumentException(ex.info.formatPretty.replace("Query,", "form content,")) } } + + implicit def formUnmarshaller(implicit fdum: Unmarshaller[FormData], mpfdum: Unmarshaller[MultipartFormData]) = + new Unmarshaller[HttpForm] { + def apply(entity: HttpEntity) = fdum(entity).left.flatMap { + case UnsupportedContentType(error1) ⇒ mpfdum(entity).left.map { + case UnsupportedContentType(error2) ⇒ UnsupportedContentType(error1 + " or " + error2) + case error ⇒ error + } + case error ⇒ Left(error) + } + } } object FormDataUnmarshallers extends FormDataUnmarshallers diff --git a/spray-httpx/src/main/scala/spray/httpx/unmarshalling/MetaUnmarshallers.scala b/spray-httpx/src/main/scala/spray/httpx/unmarshalling/MetaUnmarshallers.scala deleted file mode 100644 index 5a86e2a5aa..0000000000 --- a/spray-httpx/src/main/scala/spray/httpx/unmarshalling/MetaUnmarshallers.scala +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright © 2011-2013 the spray project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package spray.httpx.unmarshalling - -import spray.http._ - -trait MetaUnmarshallers { - - implicit def formUnmarshaller(implicit fdum: Unmarshaller[FormData], mpfdum: Unmarshaller[MultipartFormData]) = - new Unmarshaller[HttpForm] { - def apply(entity: HttpEntity) = fdum(entity).left.flatMap { - case UnsupportedContentType(error1) ⇒ mpfdum(entity).left.map { - case UnsupportedContentType(error2) ⇒ UnsupportedContentType(error1 + " or " + error2) - case error ⇒ error - } - case error ⇒ Left(error) - } - } - -} - -object MetaUnmarshallers extends MetaUnmarshallers \ No newline at end of file