Add dynamic handler management #13
5
http.go
5
http.go
|
@ -95,8 +95,13 @@ func (server httpServer) ServeHTTP(res http.ResponseWriter, req *http.Request) {
|
||||||
response := api.EmptyResponse().WithError(apiErr)
|
response := api.EmptyResponse().WithError(apiErr)
|
||||||
for key, value := range returned {
|
for key, value := range returned {
|
||||||
|
|
||||||
|
// find original name from rename
|
||||||
|
for name, param := range service.Output {
|
||||||
|
if param.Rename == key {
|
||||||
response.SetData(name, value)
|
response.SetData(name, value)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 11. apply headers
|
// 11. apply headers
|
||||||
res.Header().Set("Content-Type", "application/json; charset=utf-8")
|
res.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
|
Loading…
Reference in New Issue