All Products
Search
Document Center

4. Test functions

Last Updated: Oct 18, 2018

Access the custom domain names and test the functions. The sample code shows how to test functions using the cURL command in the CLI (Command Line Interface). You can also test functions using a browser.

Testing functions by using the cURL command

  1. ~ curl api.app.com
  2. {
  3. "path": "/",
  4. "queries": {},
  5. "headers": {
  6. "accept": "*/*",
  7. "user-agent": "curl/7.58.0"
  8. },
  9. "method": "GET",
  10. "requestURI": "/",
  11. "clientIP": "42.120.75.144",
  12. "serviceName": "serviceA",
  13. "functionName": "functionA",
  14. "body": ""
  15. }%
  16. ~ curl api.app.com/b
  17. {
  18. "path": "/b",
  19. "queries": {},
  20. "headers": {
  21. "accept": "*/*",
  22. "user-agent": "curl/7.58.0"
  23. },
  24. "method": "GET",
  25. "requestURI": "/b",
  26. "clientIP": "42.120.75.144",
  27. "serviceName": "serviceA",
  28. "functionName": "functionB",
  29. "body": ""
  30. }%
  31. ~ curl api.app.com/a
  32. {
  33. "path": "/a",
  34. "queries": {},
  35. "headers": {
  36. "accept": "*/*",
  37. "user-agent": "curl/7.58.0"
  38. },
  39. "method": "GET",
  40. "requestURI": "/a",
  41. "clientIP": "42.120.75.144",
  42. "serviceName": "serviceB",
  43. "functionName": "functionC",
  44. "body": ""
  45. }%
  46. ~ curl api.app.com/a/b
  47. {
  48. "path": "/a/b",
  49. "queries": {},
  50. "headers": {
  51. "accept": "*/*",
  52. "user-agent": "curl/7.58.0"
  53. },
  54. "method": "GET",
  55. "requestURI": "/a/b",
  56. "clientIP": "42.120.75.144",
  57. "serviceName": "serviceB",
  58. "functionName": "functionD",
  59. "body": ""
  60. }%

After binding the custom domain names, you can access the functions that have HTTP triggers configured through custom domain names.