Skip to content

"Request" local files #47

@waiting-for-dev

Description

@waiting-for-dev

Hi there. First of all, thanks for this great work.

I'm currently developing an application which needs to request some user provided URLs. My issue is related with testing it.

Testing has a lot to do with trusting, and I trust that req works fine because it has its own test suite and it is being used by the community. For this reason, I don't like and I don't see the reason why my tests should be non-deterministic because of the need to reach external end-points which could be not available at some point.

For my own confidence, it would be enough to be able to provide in my test suite a location for a local file which content would act as a response body.

Of course, I see some inconvenient with this. Maybe it is pushing the abstraction out of its scope, because, which method should that request have and which headers should the response have?

Maybe another module Nework.HTTP.Req.Testing could be added implementing the needed logic, but surely some changes in the core system would be necessary. Maybe adding another Scheme constructor called Local, or maybe to make req function not depend on Url but on something implementing a new Url type class.

How do you see it? Am I missing a better approach?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions