Skip to content

Commit 40bef89

Browse files
committed
Merge pull request #150 from VBA-tools/addbodyparameter-caching
Clear cached body on AddBodyParameter
2 parents dc7dff1 + 5f5040a commit 40bef89

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

specs/Specs_WebRequest.bas

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,18 @@ Public Function Specs() As SpecSuite
311311
.Expect(Request.Body).ToEqual "{""A"":123,""B"":456}"
312312
End With
313313

314+
With Specs.It("AddBodyParameter should override cached Body")
315+
Set Request = New WebRequest
316+
317+
Request.AddBodyParameter "A", 123
318+
319+
.Expect(Request.Body).ToEqual "{""A"":123}"
320+
321+
Request.AddBodyParameter "B", 456
322+
323+
.Expect(Request.Body).ToEqual "{""A"":123,""B"":456}"
324+
End With
325+
314326
' AddCookie
315327
' --------------------------------------------- '
316328
With Specs.It("should AddCookie")

src/WebRequest.cls

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,9 @@ Public Sub AddBodyParameter(Key As Variant, Value As Variant)
695695
Else
696696
web_pBody(Key) = Value
697697
End If
698+
699+
' Clear cached converted body
700+
web_pConvertedBody = ""
698701
End Sub
699702

700703
''

0 commit comments

Comments
 (0)