Online functions can be invoked via HTTP.
Only deployed functions can be accessed in the real environment. If you don’t know how, see: Deployment.
Invoke via HTTP
For each deployed function, you can find its URL under the function name, and it will be copied when clicked.
Send an HTTP request (either GET or POST) to the URL to call the function.
We provide a sample function that can be called in a browser to view the results:
Cross-Origin Resource Sharing (aka CORS) is mainly used to initiate cross-origin requests from browsers. AirCode enables CORS support by default to ensure that all cross-domain requests can proceed normally. Rules are:
Access-Control-Allow-Origin: It will be set according to the
Originvalue of the request, which allows cross-domain access
Access-Control-Allow-Methods: set to
GET,HEAD,PUT,PATCH,POST,DELETE, which allows all request methods
Access-Control-Allow-Headers: It will be set according to the
Access-Control-Request-Headersof the request, which allows custom headers
Access-Control-Allow-Credentials: NOT SET. For security reasons, cloud functions do not allow to carry identity information such as cookies when making cross-domain requests