(body map[string]interface{}, key string)
| 49 | } |
| 50 | |
| 51 | func getString(body map[string]interface{}, key string) (string, error) { |
| 52 | value, found := body[key] |
| 53 | if !found { |
| 54 | return "", fmt.Errorf("Missing '%s' key", key) |
| 55 | } |
| 56 | if value == nil { |
| 57 | return "", fmt.Errorf("Missing '%s' value", key) |
| 58 | } |
| 59 | typedValue, ok := value.(string) |
| 60 | if !ok { |
| 61 | return "", fmt.Errorf("Expected string value for key '%s'", key) |
| 62 | } |
| 63 | return typedValue, nil |
| 64 | } |
| 65 | |
| 66 | // detectLineBreak returns the relevant platform specific line ending |
| 67 | func detectLineBreak(haystack []byte) string { |
no outgoing calls