Skip to content

Commit fc0d5dd

Browse files
committed
Add request body specs
1 parent 5313b64 commit fc0d5dd

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.gitattributes

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain

specs/Excel-REST - Specs.xlsm

2.18 KB
Binary file not shown.

specs/RestRequestSpecs.bas

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Attribute VB_Name = "RestRequestSpecs"
1313
Public Function Specs() As SpecSuite
1414
Set Specs = New SpecSuite
1515
Dim Request As RestRequest
16+
Dim Body As Object
1617

1718
Specs.Description = "RestRequest"
1819

@@ -132,8 +133,7 @@ Public Function Specs() As SpecSuite
132133

133134
With Specs.It("should only combine body and parameters if not GET Request")
134135
Set Request = New RestRequest
135-
136-
Dim Body As Object
136+
137137
Set Body = CreateObject("Scripting.Dictionary")
138138
Body.Add "A", 123
139139

@@ -243,5 +243,22 @@ Public Function Specs() As SpecSuite
243243
.Expect(Request.FormattedResource).ToEqual "?A=20&B=3.14&C=True"
244244
End With
245245

246+
With Specs.It("should allow body or body string for GET requests")
247+
Set Request = New RestRequest
248+
Request.Method = httpGET
249+
250+
Set Body = CreateObject("Scripting.Dictionary")
251+
Body.Add "A", 123
252+
253+
Request.AddBody Body
254+
.Expect(Request.Body).ToEqual "{""A"":123}"
255+
256+
Set Request = New RestRequest
257+
Request.Method = httpGET
258+
259+
Request.AddBodyString "Howdy!"
260+
.Expect(Request.Body).ToEqual "Howdy!"
261+
End With
262+
246263
InlineRunner.RunSuite Specs
247264
End Function

0 commit comments

Comments
 (0)