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

Allow testing multipart PATCH requests #623

Open
wants to merge 1 commit into
base: 2.5.x
Choose a base branch
from

Conversation

smirzaei
Copy link

Both POST and PUT methods allow users to pass in a list of files to perform a multipart/form-data request but it is missing from the PATCH methods.

Both POST and PUT methods allow users to pass in a list of files to perform a multipart/form-data request but it is missing from the PATCH methods.
@@ -94,10 +94,14 @@ trait Client extends ImplicitConversions {
patch(uri, params)(f)
def patch[A](uri: String, params: Iterable[(String, String)])(f: => A): A =
patch(uri, params, Map[String, String]())(f)
def patch[A](uri: String, params: Iterable[(String, String)], headers: Iterable[(String, String)])(f: => A): A =
def patch[A](uri: String, params: Iterable[(String, String)], headers: Map[String, String])(f: => A): A =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looks a change for a different purpose (consistency with POST/PUT ..). Although that is a breaking change but if there is no objection from others, I think it's ok to merge for 2.5.1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, #622 and #623 should be 2.6.x series?

Copy link
Author

@smirzaei smirzaei Feb 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, after adding the new method it wouldn't compile without this change. I think I was getting ambiguity error.

patch(uri, toQueryString(params).getBytes("UTF-8"), Seq("Content-Type" -> "application/x-www-form-urlencoded; charset=utf-8") ++ headers)(f)
def patch[A](uri: String, body: Array[Byte] = Array(), headers: Iterable[(String, String)] = Seq.empty)(f: => A): A =
submit("PATCH", uri, Seq.empty, headers, body) { f }
def patch[A](uri: String, params: Iterable[(String, String)], files: Iterable[(String, Any)])(f: => A): A =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new methods look good to me.

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

Successfully merging this pull request may close these issues.

None yet

2 participants