This commit is contained in:
a 2022-03-26 21:45:23 -05:00
parent e33f80e57f
commit 61f1b4461e
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package task
import (
"encoding/json"
"encoding/xml"
"fmt"
"io"
"net/http"
@ -51,6 +52,12 @@ func (z *HttpRequest[T]) Json() func(r *HttpRequest[T]) *HttpRequest[T] {
})
}
func (z *HttpRequest[T]) Xml() func(r *HttpRequest[T]) *HttpRequest[T] {
return z.With(func(r io.Reader) Decoder {
return xml.NewDecoder(r)
})
}
func (_ *HttpRequest[T]) NoErr() func(r *HttpRequest[T]) bool {
return func(r *HttpRequest[T]) bool {
return r.err == nil