22 lines
408 B
Go
22 lines
408 B
Go
package inbox
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func resolveBodyValue(body, bodyFile string) (string, error) {
|
|
if body != "" && bodyFile != "" {
|
|
return "", fmt.Errorf("body and body-file are mutually exclusive")
|
|
}
|
|
if bodyFile == "" {
|
|
return body, nil
|
|
}
|
|
|
|
content, err := os.ReadFile(bodyFile)
|
|
if err != nil {
|
|
return "", fmt.Errorf("read body file %q: %w", bodyFile, err)
|
|
}
|
|
return string(content), nil
|
|
}
|