1
0
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:
Tim Voronov
2020-02-21 11:15:41 -05:00
parent 67dc8703c7
commit a16701e2b0
5 changed files with 25 additions and 8 deletions

View File

@@ -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)
} }

View File

@@ -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

View File

@@ -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)
} }

View File

@@ -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)
} }

View File

@@ -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)
} }