package nex import ( "bufio" "io" "net/url" "strings" "tildegit.org/tjp/sliderule/internal/types" ) // ParseRequest reads a nex request from an io.Reader. func ParseRequest(rdr io.Reader) (*types.Request, error) { line, err := bufio.NewReader(rdr).ReadString('\n') if err != nil { return nil, err } line = strings.TrimSuffix(line, "\n") line = strings.TrimSuffix(line, "\r") return &types.Request{ URL: &url.URL{ Scheme: "nex", Path: line, OmitHost: true, }, }, nil }