mirror of
https://github.com/MontFerret/ferret.git
synced 2025-11-23 21:54:45 +02:00
Updated comments for HTTP functions
This commit is contained in:
@@ -7,8 +7,11 @@ import (
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
)
|
||||
|
||||
// DELETE makes a DELETE request to the specified URL.
|
||||
// @params url or (String) - path to file to write into.
|
||||
// DELETE makes a HTTP DELETE request.
|
||||
// @params params (Object) - request parameters.
|
||||
// * url (String) - Target url
|
||||
// * body (Binary) - POST data
|
||||
// * headers (Object) optional - HTTP headers
|
||||
func DELETE(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return execMethod(ctx, h.MethodDelete, args)
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import (
|
||||
"github.com/MontFerret/ferret/pkg/runtime/values/types"
|
||||
)
|
||||
|
||||
// GET makes a GET request to the specified URL.
|
||||
// @params url or (String) - path to file to write into.
|
||||
// GET makes a HTTP GET request.
|
||||
// @params url or (String) - target url or parameters.
|
||||
// * url (String) - Target url
|
||||
// * headers (Object) optional - HTTP headers
|
||||
func GET(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
if err := core.ValidateArgs(args, 1, 1); err != nil {
|
||||
return values.None, err
|
||||
|
||||
@@ -7,8 +7,11 @@ import (
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
)
|
||||
|
||||
// POST makes a POST request to the specified URL.
|
||||
// @params url or (String) - path to file to write into.
|
||||
// POST makes a POST request.
|
||||
// @params params (Object) - request parameters.
|
||||
// * url (String) - Target url
|
||||
// * body (Binary) - POST data
|
||||
// * headers (Object) optional - HTTP headers
|
||||
func POST(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return execMethod(ctx, h.MethodPost, args)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,11 @@ import (
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
)
|
||||
|
||||
// PUT makes a PUT request to the specified URL.
|
||||
// @params url or (String) - path to file to write into.
|
||||
// PUT makes a PUT HTTP request.
|
||||
// @params params (Object) - request parameters.
|
||||
// * url (String) - Target url.
|
||||
// * body (Binary) - POST data.
|
||||
// * headers (Object) optional - HTTP headers.
|
||||
func PUT(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return execMethod(ctx, h.MethodPut, args)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@ type Params struct {
|
||||
Body values.Binary
|
||||
}
|
||||
|
||||
// REQUEST makes a HTTP request.
|
||||
// @params params (Object) - request parameters.
|
||||
// * method (String) - HTTP method.
|
||||
// * url (String) - Target url.
|
||||
// * body (Binary) - POST data.
|
||||
// * headers (Object) optional - HTTP headers.
|
||||
func REQUEST(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return execMethod(ctx, "", args)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user