header.es.tst 605 B

1234567891011121314151617181920212223242526
  1. /*
  2. header.tst - Http response header tests
  3. */
  4. const HTTP = tget('TM_HTTP') || "127.0.0.1:8080"
  5. const URL = HTTP + "/index.html"
  6. let http: Http = new Http
  7. http.get(HTTP + "/index.html")
  8. connection = http.header("Connection")
  9. ttrue(connection == "keep-alive")
  10. http.get(HTTP + "/index.html")
  11. ttrue(http.statusMessage == "OK")
  12. ttrue(http.contentType == "text/html")
  13. ttrue(http.date != "")
  14. ttrue(http.lastModified != "")
  15. http.post(HTTP + "/index.html")
  16. ttrue(http.status == 200)
  17. // Request headers
  18. http.reset()
  19. http.setHeader("key", "value")
  20. http.get(HTTP + "/index.html")
  21. ttrue(http.status == 200)