rootstrap / ios-base

Boilerplate for new iOS projects using Swift 5. Provides a handful of functionalities.
https://rootstrap.com/
MIT License
259 stars 63 forks source link

add .patch case to JSONEncoding.default in APIClient #98

Closed cuylerquint closed 5 years ago

cuylerquint commented 5 years ago

Great repo 😄!! Attempted to push a branch and PR but got 'denied access' 🤕. would love to contribute! Took me a while to figure out why my server wasn't processing the request correctly but found out that patch wasn't using JSON encoding at default 😉

one liner in my attempted PR:

class func defaultEncoding(forMethod method: HTTPMethod) -> ParameterEncoding {
    switch method {
    case .post, .put:
      return JSONEncoding.default
    default:
      return URLEncoding.default
    }
  }

to

class func defaultEncoding(forMethod method: HTTPMethod) -> ParameterEncoding {
    switch method {
    case .post, .put, .patch:
      return JSONEncoding.default
    default:
      return URLEncoding.default
    }
  }
glm4 commented 5 years ago

Hey @cuylerquint, thanks for contributing. Good catch, we will be updating it soon. 💪

cuylerquint commented 5 years ago

thanks @glm4 no problem, love helping out 👍

glm4 commented 5 years ago

Solved!