Skip to content

Commit

Permalink
fixed #8
Browse files Browse the repository at this point in the history
  • Loading branch information
rezmoss authored Sep 13, 2024
1 parent 6c6551a commit b33a711
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,38 @@ func Delete(urlStr string, options ...*requestOptions) (*Response, error) {
}

func DeleteAsync(urlStr string, options ...*requestOptions) *Promise {
resp, err := Request("DELETE", urlStr, options...)
return &Promise{response: resp, err: err}
promise := NewPromise()
go func() {
resp, err := Request("DELETE", urlStr, options...)
promise.resolve(resp, err)
}()
return promise
}

func Head(urlStr string, options ...*requestOptions) (*Response, error) {
return Request("HEAD", urlStr, options...)
}

func HeadAsync(urlStr string, options ...*requestOptions) *Promise {
resp, err := Request("HEAD", urlStr, options...)
return &Promise{response: resp, err: err}
promise := NewPromise()
go func() {
resp, err := Request("HEAD", urlStr, options...)
promise.resolve(resp, err)
}()
return promise
}

func Options(urlStr string, options ...*requestOptions) (*Response, error) {
return Request("OPTIONS", urlStr, options...)
}

func OptionsAsync(urlStr string, options ...*requestOptions) *Promise {
resp, err := Request("OPTIONS", urlStr, options...)
return &Promise{response: resp, err: err}
promise := NewPromise()
go func() {
resp, err := Request("OPTIONS", urlStr, options...)
promise.resolve(resp, err)
}()
return promise
}

func Patch(urlStr string, body interface{}, options ...*requestOptions) (*Response, error) {
Expand Down

0 comments on commit b33a711

Please sign in to comment.