diff --git a/pkg/stdlib/io/net/http/delete.go b/pkg/stdlib/io/net/http/delete.go index 672616b6..5440395c 100644 --- a/pkg/stdlib/io/net/http/delete.go +++ b/pkg/stdlib/io/net/http/delete.go @@ -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) } diff --git a/pkg/stdlib/io/net/http/get.go b/pkg/stdlib/io/net/http/get.go index 9ef93b29..d6b3a550 100644 --- a/pkg/stdlib/io/net/http/get.go +++ b/pkg/stdlib/io/net/http/get.go @@ -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 diff --git a/pkg/stdlib/io/net/http/post.go b/pkg/stdlib/io/net/http/post.go index fdcce9d2..a4f906ab 100644 --- a/pkg/stdlib/io/net/http/post.go +++ b/pkg/stdlib/io/net/http/post.go @@ -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) } diff --git a/pkg/stdlib/io/net/http/put.go b/pkg/stdlib/io/net/http/put.go index c823a606..09cf565c 100644 --- a/pkg/stdlib/io/net/http/put.go +++ b/pkg/stdlib/io/net/http/put.go @@ -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) } diff --git a/pkg/stdlib/io/net/http/request.go b/pkg/stdlib/io/net/http/request.go index aa0ad121..ad0b0ff9 100644 --- a/pkg/stdlib/io/net/http/request.go +++ b/pkg/stdlib/io/net/http/request.go @@ -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) }