readRequestBlob takes a JSON-blob-encoded response body in the form map[string]string and returns it, the list of keywords presented, and any error that occurred.
(r *http.Request)
| 90 | // map[string]string and returns it, the list of keywords presented, |
| 91 | // and any error that occurred. |
| 92 | func readRequestBlob(r *http.Request) (map[string]string, error) { |
| 93 | var blob map[string]string |
| 94 | |
| 95 | body, err := io.ReadAll(r.Body) |
| 96 | if err != nil { |
| 97 | return nil, err |
| 98 | } |
| 99 | r.Body.Close() |
| 100 | |
| 101 | err = json.Unmarshal(body, &blob) |
| 102 | if err != nil { |
| 103 | return nil, err |
| 104 | } |
| 105 | return blob, nil |
| 106 | } |
| 107 | |
| 108 | // ProcessRequestOneOf reads a JSON blob for the request and makes |
| 109 | // sure it contains one of a set of keywords. For example, a request |
no test coverage detected
searching dependent graphs…