Exemplo n.º 1
0
func detectContentTypeAndEventID(header http.Header) (string, string, error) {
	contentType, err := httputil.GetSingleValueFromHeader("Content-Type", header)
	if err != nil {
		return "", "", fmt.Errorf("Issue with Content-Type Header: %s", err)
	}

	ghEvent, err := httputil.GetSingleValueFromHeader("X-Github-Event", header)
	if err != nil {
		return "", "", fmt.Errorf("Issue with X-Github-Event Header: %s", err)
	}

	return contentType, ghEvent, nil
}
Exemplo n.º 2
0
func getContentTypeFromHeader(header http.Header) string {
	contentType, err := httputil.GetSingleValueFromHeader("Content-Type", header)
	if err != nil {
		return ""
	}
	return contentType
}
Exemplo n.º 3
0
func detectContentType(header http.Header) (string, error) {
	contentType, err := httputil.GetSingleValueFromHeader("Content-Type", header)
	if err != nil {
		return "", fmt.Errorf("Issue with Content-Type Header: %s", err)
	}

	return contentType, nil
}
Exemplo n.º 4
0
func detectContentTypeAttemptNumberAndEventKey(header http.Header) (string, string, string, error) {
	contentType, err := httputil.GetSingleValueFromHeader("Content-Type", header)
	if err != nil {
		return "", "", "", fmt.Errorf("Issue with Content-Type Header: %s", err)
	}

	eventKey, err := httputil.GetSingleValueFromHeader("X-Event-Key", header)
	if err != nil {
		return "", "", "", fmt.Errorf("Issue with X-Event-Key Header: %s", err)
	}

	attemptNum, err := httputil.GetSingleValueFromHeader("X-Attempt-Number", header)
	if err != nil {
		return "", "", "", fmt.Errorf("Issue with X-Attempt-Number Header: %s", err)
	}

	return contentType, attemptNum, eventKey, nil
}