test.pas 685 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Please See: http://en.wikipedia.org/wiki/Chunked_transfer_encoding
  2. unit Test;
  3. {$mode objfpc}{$H+}
  4. interface
  5. uses
  6. BrookAction, BrookHTTPConsts;
  7. type
  8. TTest = class(TBrookAction)
  9. public
  10. procedure Get; override;
  11. end;
  12. implementation
  13. procedure TTest.Get;
  14. begin
  15. HttpResponse.ContentType := BROOK_HTTP_CONTENT_TYPE_TEXT_PLAIN;
  16. HttpResponse.SetCustomHeader(BROOK_HTTP_HEADER_TRANSFER_ENCODING,
  17. BROOK_HTTP_TRANSFER_ENCODING_CHUNKED);
  18. Write('23');
  19. Write('This is the data in the first chunk');
  20. Write('1A');
  21. Write('and this is the second one');
  22. Write('A');
  23. Write('1234567890');
  24. Write('0');
  25. Write('');
  26. end;
  27. initialization
  28. TTest.Register('*');
  29. end.