All Products
Search
Document Center

3. Test functions

Last Updated: Aug 07, 2018

To check whether a function can be executed properly or not, you can send an HTTP request to that function using a browser, the cURL, or the console. To trigger the execution of a function, you must send an HTTP request to the following address:

  1. <account_id>.<region>.fc.aliyuncs.com/<version>/proxy/<serviceName>/<functionName>/[action?queries]

Attention

In the preceding step, anonymous authentication is selected when a trigger is created. This is a simple, but not extremely secure, authentication mode, as anyone can send an HTTP request to call your functions. Therefore, we recommend that you use the function authentication mode that requires Authorization and Date information be included in an HTTP request. For more information, see HTTP triggers.

Use the console for debugging

  1. Select a function. On the displayed page, click the Code tab and scroll down the page until the Params tab is displayed.

  2. Click the Params tab and enter the key-value pairs. The key-value pairs are automatically added to the HTTP URL.

    params

  3. Click the Header tab and enter the key-value pairs for the request header.

    headers

  4. Click Invoke.

    If you send an HTTP request using the browser, the execution result is as follows:

    Response

After the preceding steps are completed, a web server is built based on an HTTP trigger. You can then code to process the HTTP request.