File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ case class Req(
6363}
6464
6565object Req {
66- final case class Properties (bodyType : BodyType = NoBody )
66+ final case class Properties (bodyType : BodyType = NoBody , methodExplicitlySet : Boolean = false )
6767
6868 trait BodyType
6969 final case object NoBody extends BodyType
@@ -409,21 +409,18 @@ trait RequestBuilderVerbs extends RequestVerbs {
409409 ) }
410410 }
411411
412- private [this ] var methodExplicitlySet : Boolean = false
413-
414412 /**
415413 * Explicitly set the method of the request.
416414 */
417415 def setMethod (method : String ) = {
418- methodExplicitlySet = true
419- subject.underlying(_.setMethod(method))
416+ subject.underlying(_.setMethod(method), _.copy(methodExplicitlySet = true ))
420417 }
421418
422419 /**
423420 * Set method unless method has been explicitly set using [[setMethod ]].
424421 */
425422 def implyMethod (method : String ) = {
426- if (! methodExplicitlySet) {
423+ if (! subject.props. methodExplicitlySet) {
427424 subject.underlying(_.setMethod(method))
428425 } else {
429426 subject
Original file line number Diff line number Diff line change @@ -96,6 +96,20 @@ with DispatchCleanup {
9696 res() ?= (" POST" + sample)
9797 }
9898
99+ property(" PUT alphaString body with setBody and get response" ) = forAll(Gen .alphaStr) { (sample : String ) =>
100+ val res = Http .default(
101+ (localhost / " echobody" ).PUT .setBody(sample) > as.String
102+ )
103+ res() ?= (" PUT" + sample)
104+ }
105+
106+ property(" PUT alphaString body with << and get response" ) = forAll(Gen .alphaStr) { (sample : String ) =>
107+ val res = Http .default(
108+ (localhost / " echobody" ).PUT << sample > as.String
109+ )
110+ res() ?= (" PUT" + sample)
111+ }
112+
99113 property(" GET and handle" ) = forAll(Gen .alphaStr) { (sample : String ) =>
100114 val res = Http .default(
101115 localhost / " echo" <<? Map (" echo" -> sample) > as.String
You can’t perform that action at this time.
0 commit comments