From 06093ed39d7f1e4a7b0e49f9963d2ad2d108d3bd Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 16 Nov 2023 23:00:59 +0700 Subject: all: refactoring, rename HttpResponse to ExecResponse --- exec_response.go | 12 ++++++++++++ http_response.go | 11 ----------- http_server.go | 2 +- http_server_play_test.go | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 exec_response.go delete mode 100644 http_response.go diff --git a/exec_response.go b/exec_response.go new file mode 100644 index 0000000..661189f --- /dev/null +++ b/exec_response.go @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2021 M. Shulhan +// SPDX-License-Identifier: GPL-3.0-or-later + +package awwan + +// ExecResponse contains the request and output of command execution, from +// ExecRequest. +type ExecResponse struct { + *ExecRequest + Error string `json:"error"` + Output []byte `json:"output"` +} diff --git a/http_response.go b/http_response.go deleted file mode 100644 index c4f5988..0000000 --- a/http_response.go +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-FileCopyrightText: 2021 M. Shulhan -// SPDX-License-Identifier: GPL-3.0-or-later - -package awwan - -// HttpResponse contains the output of command execution. -type HttpResponse struct { - *ExecRequest - Error string `json:"error"` - Output []byte `json:"output"` -} diff --git a/http_server.go b/http_server.go index 391110c..0996432 100644 --- a/http_server.go +++ b/http_server.go @@ -612,7 +612,7 @@ func (httpd *httpServer) awwanApiExecute(epr *libhttp.EndpointRequest) (resb []b } var ( - data = &HttpResponse{ + data = &ExecResponse{ ExecRequest: req, } diff --git a/http_server_play_test.go b/http_server_play_test.go index 008e60b..1879ec8 100644 --- a/http_server_play_test.go +++ b/http_server_play_test.go @@ -112,7 +112,7 @@ func testHttpExecute(t *testing.T, httpd *httpServer, tdata *test.Data, tag stri test.Assert(t, tag, string(expResp), bbuf.String()) var ( - execRes HttpResponse + execRes ExecResponse epRes libhttp.EndpointResponse err error ) -- cgit v1.3