Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Declarative proxy for decoupling web requests from their delivery. Similar to js `fetch()`; helpful in unit-tests.

License

Notifications You must be signed in to change notification settings

quickthyme/WebRequest

Repository files navigation

WebRequest

release_version build status swiftpm_compatible license

WebRequest decouples network resources from their request declarations.

A WebRequest allows you to compose all of the pieces and parts needed to build, execute, and test any sort of network request, using either static composition or dynamic building. Just describe the request, inject the web delivery-mechanism, then execute.

The WebResponse you get back will have the original request attached along with the status code, headers, and other data depending on whichever mechanism was used.

It comes with 4 built-in delivery mechanisms out of the box, all of which natively use Apple's URLSession:

  • HTTPWebRequestDelivery - default RFC-3986 and x-www-form-urlencoded interactions over HTTP
  • JSONWebRequestDelivery - same as HTTP, but tuned for JSON purposes
  • FileDownloadWebRequestDelivery - for file download requests
  • MultipartFormUploadWebRequestDelivery - for uploading files

To extend functionality, you can create new ones from scratch (such as if you want to wrap another request library like AlamoFire), or you can subclass the default ones and tweak them to your needs.

About

Declarative proxy for decoupling web requests from their delivery. Similar to js `fetch()`; helpful in unit-tests.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

Languages

AltStyle によって変換されたページ (->オリジナル) /