mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
REST API: remove status from ApiResponse
it duplicates the header HTTP status
This commit is contained in:
6
.github/workflows/development.yml
vendored
6
.github/workflows/development.yml
vendored
@@ -15,9 +15,6 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
upload-coverage: [true]
|
upload-coverage: [true]
|
||||||
include:
|
include:
|
||||||
- go: 1.13
|
|
||||||
os: ubuntu-latest
|
|
||||||
upload-coverage: false
|
|
||||||
- go: 1.14
|
- go: 1.14
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
upload-coverage: false
|
upload-coverage: false
|
||||||
@@ -80,10 +77,13 @@ jobs:
|
|||||||
if: startsWith(matrix.os, 'windows-') != true
|
if: startsWith(matrix.os, 'windows-') != true
|
||||||
run: |
|
run: |
|
||||||
mkdir -p output/{bash_completion,zsh_completion}
|
mkdir -p output/{bash_completion,zsh_completion}
|
||||||
|
mkdir -p output/examples/rest-api-cli
|
||||||
cp sftpgo output/
|
cp sftpgo output/
|
||||||
cp sftpgo.json output/
|
cp sftpgo.json output/
|
||||||
cp -r templates output/
|
cp -r templates output/
|
||||||
cp -r static output/
|
cp -r static output/
|
||||||
|
cp -r init output/
|
||||||
|
cp examples/rest-api-cli/sftpgo_api_cli.py output/examples/rest-api-cli/
|
||||||
./sftpgo gen completion bash > output/bash_completion/sftpgo-completion.bash
|
./sftpgo gen completion bash > output/bash_completion/sftpgo-completion.bash
|
||||||
./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
|
./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
|
||||||
./sftpgo gen man -d output/man/man1
|
./sftpgo gen man -d output/man/man1
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ sudo systemctl enable sftpgo
|
|||||||
# optional, install the REST API CLI. It requires python-requests to run
|
# optional, install the REST API CLI. It requires python-requests to run
|
||||||
sudo install -Dm755 examples/rest-api-cli/sftpgo_api_cli.py /usr/bin/sftpgo_api_cli
|
sudo install -Dm755 examples/rest-api-cli/sftpgo_api_cli.py /usr/bin/sftpgo_api_cli
|
||||||
# optional, create shell completion script, for example for bash
|
# optional, create shell completion script, for example for bash
|
||||||
sudo /usr/bin/sftpgo gen completion bash > /etc/bash_completion.d/sftpgo-completion.bash
|
sudo sh -c '/usr/bin/sftpgo gen completion bash > /etc/bash_completion.d/sftpgo-completion.bash'
|
||||||
# optional, create man pages
|
# optional, create man pages
|
||||||
sudo /usr/bin/sftpgo gen man -d /usr/share/man/man1
|
sudo /usr/bin/sftpgo gen man -d /usr/share/man/man1
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ func sendAPIResponse(w http.ResponseWriter, r *http.Request, err error, message
|
|||||||
resp := apiResponse{
|
resp := apiResponse{
|
||||||
Error: errorString,
|
Error: errorString,
|
||||||
Message: message,
|
Message: message,
|
||||||
HTTPStatus: code,
|
|
||||||
}
|
}
|
||||||
ctx := context.WithValue(r.Context(), render.StatusCtxKey, code)
|
ctx := context.WithValue(r.Context(), render.StatusCtxKey, code)
|
||||||
render.JSON(w, r.WithContext(ctx), resp)
|
render.JSON(w, r.WithContext(ctx), resp)
|
||||||
|
|||||||
@@ -82,9 +82,8 @@ type Conf struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type apiResponse struct {
|
type apiResponse struct {
|
||||||
Error string `json:"error"`
|
Error string `json:"error,omitempty"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
HTTPStatus int `json:"status"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize configures and starts the HTTP server
|
// Initialize configures and starts the HTTP server
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user