20 lines
345 B
Go
20 lines
345 B
Go
package http
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func writeHTTPError(w http.ResponseWriter, errorMessage string, statusCode int) {
|
|
http.Error(w, errorMessage, statusCode)
|
|
}
|
|
|
|
func removeEmptySegments(urlSegments []string) []string {
|
|
var result []string
|
|
for _, s := range urlSegments {
|
|
if s != "" {
|
|
result = append(result, s)
|
|
}
|
|
}
|
|
return result
|
|
}
|