(r *http.Request)
| 15 | ) |
| 16 | |
| 17 | func checkBodyNotEmpty(r *http.Request) error { |
| 18 | // Check whether the request body is empty. |
| 19 | data, err := ioutil.ReadAll(r.Body) |
| 20 | if err != nil { |
| 21 | return err |
| 22 | } |
| 23 | if len(data) == 0 { |
| 24 | return fmt.Errorf("passed body is empty") |
| 25 | } |
| 26 | return nil |
| 27 | } |
| 28 | |
| 29 | // externalID extracts the external identifier of the given attributes. |
| 30 | func externalID(attributes scim.ResourceAttributes) optional.String { |