mirror of
https://github.com/IBM/fp-go.git
synced 2025-08-10 22:31:32 +02:00
fix: remove unnecesary indirection in E.TryCatch
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -35,17 +35,13 @@ var (
|
||||
func bodyRequest(method string) func(string) func([]byte) E.Either[error, *http.Request] {
|
||||
return func(url string) func([]byte) E.Either[error, *http.Request] {
|
||||
return func(body []byte) E.Either[error, *http.Request] {
|
||||
return E.TryCatchError(func() (*http.Request, error) {
|
||||
return http.NewRequest(method, url, bytes.NewReader(body))
|
||||
})
|
||||
return E.TryCatchError(http.NewRequest(method, url, bytes.NewReader(body)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func noBodyRequest(method string) func(string) E.Either[error, *http.Request] {
|
||||
return func(url string) E.Either[error, *http.Request] {
|
||||
return E.TryCatchError(func() (*http.Request, error) {
|
||||
return http.NewRequest(method, url, nil)
|
||||
})
|
||||
return E.TryCatchError(http.NewRequest(method, url, nil))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user