Skip to content

Commit

Permalink
Methods that return Array[Byte] shoud not deserilize.
Browse files Browse the repository at this point in the history
  • Loading branch information
rinmalavi committed Sep 12, 2014
1 parent aac8257 commit 7877009
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions http/src/main/scala/com/dslplatform/api/client/HttpClient.scala
Expand Up @@ -143,7 +143,7 @@ class HttpClient(
optBody: Option[Array[Byte]],
url: String,
expectedStatus: Set[Int],
additionalHeaders: Map[String, Set[String]]): Future[Array[Byte]] = {
additionalHeaders: Headers): Future[Array[Byte]] = {
val request = new RequestBuilder()
.setUrl(url)
.setHeaders(makeNingHeaders(additionalHeaders))
Expand All @@ -164,7 +164,7 @@ class HttpClient(
promisedResponse future
}

private[client] def sendRawRequest(
def sendRawRequest(
method: HttpMethod,
service: String,
expectedStatus: Set[Int],
Expand Down Expand Up @@ -193,22 +193,22 @@ class HttpClient(
case _ => None
}

doRequest(method.name, optBody, url, expectedStatus, additionalHeaders) map (json.deserializeList[String](_))
doRequest(method.name, optBody, url, expectedStatus, additionalHeaders) map (json.deserializeList[String])
}

private[client] def sendRequest[TResult: ClassTag](
method: HttpMethod,
service: String,
expectedStatus: Set[Int],
additionalHeaders: Map[String, Set[String]] = Map.empty): Future[TResult] =
sendRawRequest(method, service, expectedStatus, additionalHeaders) map (json.deserialize[TResult](_))
sendRawRequest(method, service, expectedStatus, additionalHeaders) map (json.deserialize[TResult])

private[client] def sendRequestForCollection[TResult: ClassTag](
method: HttpMethod,
service: String,
expectedStatus: Set[Int],
additionalHeaders: Map[String, Set[String]] = Map.empty): Future[IndexedSeq[TResult]] =
sendRawRequest(method, service, expectedStatus, additionalHeaders) map (json.deserializeList[TResult](_))
sendRawRequest(method, service, expectedStatus, additionalHeaders) map (json.deserializeList[TResult])

private[client] def sendRequestForCollection[TResult](
returnClass: Class[_],
Expand Down
Expand Up @@ -29,10 +29,11 @@ class HttpReportingProxy(httpClient: HttpClient)
def createReport[TResult](
report: Report[TResult],
templater: String): Future[Array[Byte]] =
httpClient.sendRequest[Array[Byte]](
httpClient.sendRawRequest(
PUT(report),
ReportingUri / "report" / httpClient.getDslName(report.getClass) / templater,
Set(201))
Set(201),
Map("Accept" -> Set("application/octet-stream")))

def olapCube[TCube <: Cube[TSearchable]: ClassTag, TSearchable <: Searchable: ClassTag](
templater: String,
Expand All @@ -49,12 +50,12 @@ class HttpReportingProxy(httpClient: HttpClient)
case Some(spec) =>
val specClass = spec.getClass
val specName: String = if (parentName == cubeName) parentName + "/" else ""
httpClient.sendRequest[Array[Byte]](
httpClient.sendRawRequest(
PUT(specification),
ReportingUri / "olap" / cubeName / specName + specClass.getSimpleName().replace("$", "") / templater + args,
Set(200))
case _ =>
httpClient.sendRequest[Array[Byte]](
httpClient.sendRawRequest(
GET, ReportingUri / "olap" / cubeName / templater + args, Set(200))
}
}
Expand Down

0 comments on commit 7877009

Please sign in to comment.