Skip to content

Commit

Permalink
[-] formatted text output and updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
bnkamalesh committed Jan 9, 2025
1 parent 9af24ec commit 482b5ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ func main() {
}
```

Below is an example of probe responses for HTTP requests using curl.

```bash
$ curl -H 'Accept: text/plain' localhost:1234/-/startup
mydb: OK | probe->live: OK: 2025-01-09T17:45:24+01:00 | probe->ready: OK: 2025-01-09T17:45:24+01:00 | probe->startup: OK: 2025-01-09T17:45:24+01:00 |

$ curl -H 'Accept: text/plain' localhost:1234/-/ready
probe->ready: OK: 2025-01-09T17:45:24+01:00 | probe->startup: OK: 2025-01-09T17:45:24+01:00 | mydb: OK | probe->live: OK: 2025-01-09T17:45:24+01:00 |

$ curl -H 'Accept: text/plain' localhost:1234/-/live
probe->startup: OK: 2025-01-09T17:45:24+01:00 | mydb: OK | probe->live: OK: 2025-01-09T17:45:24+01:00 | probe->ready: OK: 2025-01-09T17:45:24+01:00 |
```

## The gopher

The gopher used here was created using [Gopherize.me](https://gopherize.me/). Just like the handyman gopher here, proberesponder helps setup, well, a probe responder!
2 changes: 1 addition & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func responseAsHTML(payload map[string]string) []byte {
func responseAsPlainText(payload map[string]string) []byte {
buff := bytes.NewBuffer([]byte{})
for key, value := range payload {
buff.WriteString(fmt.Sprintf("%s: %s|", key, value))
buff.WriteString(fmt.Sprintf("%s: %s | ", key, value))
}
return buff.Bytes()
}
Expand Down

0 comments on commit 482b5ef

Please sign in to comment.