Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ServiceRequest API #52

Closed
angelodipaolo opened this issue Oct 19, 2016 · 0 comments
Closed

Add ServiceRequest API #52

angelodipaolo opened this issue Oct 19, 2016 · 0 comments
Milestone

Comments

@angelodipaolo
Copy link
Contributor

As part of the work to separate the request API from ServiceTask, a new ServiceRequest struct type will be addded to replace for ServiceTask's requesting building API.

Currently ServiceTask API conflates request building with response processing:

service
  .POST("/brews")
  .setFormParameters(["foo": "bar"])
  .response { data, response in
    // process response
  }
  .resume()

With the new request API, ServiceRequest and ServiceTask values can be created independently for greater flexibility.

// create a request
var request = service.request(.post, "/brews")
request.formParameters = ["foo": "bar"]

// spawn a task instance for sending the request and processing the response
service
  .task(request: request)
  .response { data, response in
    // process response
  }
  .resume()
@angelodipaolo angelodipaolo added this to the v4.0.0 milestone Oct 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant