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"
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DELETE makes a DELETE request to the specified URL.
|
// DELETE makes a HTTP DELETE request.
|
||||||
// @params url or (String) - path to file to write into.
|
// @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) {
|
func DELETE(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||||
return execMethod(ctx, h.MethodDelete, args)
|
return execMethod(ctx, h.MethodDelete, args)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import (
|
|||||||
"github.com/MontFerret/ferret/pkg/runtime/values/types"
|
"github.com/MontFerret/ferret/pkg/runtime/values/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GET makes a GET request to the specified URL.
|
// GET makes a HTTP GET request.
|
||||||
// @params url or (String) - path to file to write into.
|
// @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) {
|
func GET(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||||
if err := core.ValidateArgs(args, 1, 1); err != nil {
|
if err := core.ValidateArgs(args, 1, 1); err != nil {
|
||||||
return values.None, err
|
return values.None, err
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import (
|
|||||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// POST makes a POST request to the specified URL.
|
// POST makes a POST request.
|
||||||
// @params url or (String) - path to file to write into.
|
// @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) {
|
func POST(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||||
return execMethod(ctx, h.MethodPost, args)
|
return execMethod(ctx, h.MethodPost, args)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import (
|
|||||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PUT makes a PUT request to the specified URL.
|
// PUT makes a PUT HTTP request.
|
||||||
// @params url or (String) - path to file to write into.
|
// @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) {
|
func PUT(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||||
return execMethod(ctx, h.MethodPut, args)
|
return execMethod(ctx, h.MethodPut, args)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ type Params struct {
|
|||||||
Body values.Binary
|
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) {
|
func REQUEST(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||||
return execMethod(ctx, "", args)
|
return execMethod(ctx, "", args)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user