FsHttp icon indicating copy to clipboard operation
FsHttp copied to clipboard

Implement Request/Response.ToString() and use print functions

Open SchlenkR opened this issue 3 years ago • 0 comments

print functions for the FsHttp representation of Request and Response records are currently implemented in Print.fs, which export Request.print () and Response.print (). Those functions are only used when FsHttp is used in FSI (see FsiInit.fs).

It would be nice (e.g. for debugging purpose or in non-FSI environments) having a ToString() overload per-default in Response and Request that output similar information as when using print(). Since the print function implementation is long, it should not "pollute" the definition of Request and Response (which are defined in Domain.fs) and stay separated from definitions in Domain.fs.

What could be a good way of bringing together

  • Print functions reside in a separate module
  • ToString implementation for Response and Request generalls using the ones in Print module
  • Slightly different ToString / print implementations for non-FSI and FSI, which is: In non-FSI environments, any ToString() implementation should not cause side effects (e.g. like reading from Request/Response streams).

?

SchlenkR avatar Sep 28 '21 11:09 SchlenkR