@@ -72,73 +72,53 @@ class DelphiRoutes(requestLimiter: RequestLimitScheduler) extends JsonSupport wi
72
72
73
73
private def features = {
74
74
get {
75
- parameter(Symbol (" pretty" ).? ) { (pretty) =>
76
- complete(
77
- HttpResponse (StatusCodes .OK ,
78
- List (headers.`Content-Type`(ContentTypes .`application/json`)),
79
- prettyPrint(pretty, featureExtractor.featureList.toJson)))
80
- }
75
+ complete(featureExtractor.featureList.toJson)
81
76
}
82
77
}
83
78
84
79
85
80
private def statistics = {
86
81
get {
87
- parameter(Symbol (" pretty" ).? ) { (pretty) =>
88
- complete {
89
- val result = new StatisticsQuery (configuration).retrieveStandardStatistics
90
- result match {
91
- case Some (stats) => {
92
- HttpResponse (StatusCodes .OK ,
93
- List (headers.`Content-Type`(ContentTypes .`application/json`)),
94
- prettyPrint(pretty, stats.toJson))
95
- }
96
- case _ => HttpResponse (StatusCodes .InternalServerError )
97
- }
82
+ complete {
83
+ val result = new StatisticsQuery (configuration).retrieveStandardStatistics
84
+ result match {
85
+ case Some (stats) => stats.toJson
86
+ case _ => HttpResponse (StatusCodes .InternalServerError )
98
87
}
99
88
}
100
89
}
101
90
}
102
91
103
92
private def retrieve (identifier : String ): Route = {
104
93
get {
105
- parameter(Symbol (" pretty" ).? ) { (pretty) =>
106
- complete(
107
- RetrieveQuery .retrieve(identifier) match {
108
- case Some (result) => HttpResponse (StatusCodes .OK ,
109
- List (headers.`Content-Type`(ContentTypes .`application/json`)),
110
- prettyPrint(pretty, result.toJson))
111
- case None => HttpResponse (StatusCodes .NotFound )
112
- }
113
- )
114
- }
94
+ complete(
95
+ RetrieveQuery .retrieve(identifier) match {
96
+ case Some (result) => result.toJson
97
+ case None => HttpResponse (StatusCodes .NotFound )
98
+ }
99
+ )
115
100
}
116
101
}
117
102
118
103
def search : Route = {
119
104
post {
120
- parameter(Symbol (" pretty" ).? ) { (pretty) =>
121
- entity(as[QueryRequest ]) { input =>
122
- log.info(s " Received search query: ${input.query}" )
123
- complete(
124
- new SearchQuery (configuration, featureExtractor).search(input) match {
125
- case Success (result) =>
126
- HttpResponse (StatusCodes .OK ,
127
- List (headers.`Content-Type`(ContentTypes .`application/json`)),
128
- prettyPrint(pretty, result.toJson))
129
- case Failure (e) => {
130
- e match {
131
- case se : SearchError => {
132
- HttpResponse (StatusCodes .ServerError (StatusCodes .InternalServerError .intValue)(se.toJson.toString(), " " ))
133
- }
134
- case _ => {
135
- HttpResponse (StatusCodes .ServerError (StatusCodes .InternalServerError .intValue)(" Search query failed" , " " ))
136
- }
105
+ entity(as[QueryRequest ]) { input =>
106
+ log.info(s " Received search query: ${input.query}" )
107
+ complete(
108
+ new SearchQuery (configuration, featureExtractor).search(input) match {
109
+ case Success (result) => result.toJson
110
+ case Failure (e) => {
111
+ e match {
112
+ case se : SearchError => {
113
+ HttpResponse (StatusCodes .ServerError (StatusCodes .InternalServerError .intValue)(se.toJson.toString(), " " ))
114
+ }
115
+ case _ => {
116
+ HttpResponse (StatusCodes .ServerError (StatusCodes .InternalServerError .intValue)(" Search query failed" , " " ))
137
117
}
138
118
}
139
- }
140
- )
141
- }
119
+ }
120
+ }
121
+ )
142
122
}
143
123
}
144
124
}
0 commit comments