You need to send HTTP requests to the function to test whether the function runs as expected. You can use the Function Compute console or a browser to send HTTP requests to test whether the function is correct.
Test the function in the Function Compute console
- Log on to the Function Compute console.
- In the top navigation bar, select a region.
- In the left-side navigation pane, click Service/Function.
- Find the target function in the target service and click the name of the function.
- Click the Code tab and scroll down the page to the HTTP Trigger Debugging section.
- Enter the key-value pairs in the key and value fields on the Params and Header tabs, respectively.After you enter the key-value pairs, you can see the HTTP trigger URL automatically assembled by the Function Compute platform.
- Click Execute.The execution result of the function is displayed.
Test the function by using a browser
- Assemble the HTTP trigger URL.The assembly rules of the HTTP trigger URL are as follows:
The example is as follows:
123456.cn-shanghai.fc.aliyuncs.com/2016-08-15/proxy/serviceName/functionName/action? hello=worldThe parameters in URL are described as follows:
Parameter Description account_id The ID of an Alibaba Cloud account.
You can retrieve your account ID in Security Settings If you are using a Resource Access Management (RAM) user, move the pointer over your profile picture in the upper-right corner of the console to view your Alibaba Cloud account ID.
region The region where the Function Compute instance is located. version The API version of Function Compute. action The custom request path. serviceName The service name. functionName The function name. queries The query parameter.
- In the address bar of your browser, enter the HTTP trigger URL and press Enter.The browser returns the execution result.