全部产品

4. 测试函数

更新时间:2018-09-19 14:12:25

设置成功后,访问自定义域名进行测试,示例演示通过命令行 curl url 进行测试,您也可以通过浏览器测试。

通过命令行 crul 测试

  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. }%

可以看出绑定自定义域名后,可以通过自定义域名成功访问设置了 HTTP 触发器的函数。