Skip to content

Commit f1d6673

Browse files
committed
updated julia tests
1 parent 21cc9aa commit f1d6673

File tree

1 file changed

+52
-45
lines changed

1 file changed

+52
-45
lines changed

test/codegen/julia_http_codegen_test.dart

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ url = "https://api.apidash.dev"
1515
1616
response = HTTP.request("GET", url, status_exception=false)
1717
18-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
18+
println("Status Code: $(response.status)")
1919
println("Response Body: \n$(String(response.body))")
2020
""";
2121
expect(
@@ -32,12 +32,12 @@ println("Response Body: \n$(String(response.body))")
3232
url = "https://api.apidash.dev/country/data"
3333
3434
params = Dict(
35-
"code" => "US",
35+
"code" =>["US"],
3636
)
3737
3838
response = HTTP.request("GET", url, query=params, status_exception=false)
3939
40-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
40+
println("Status Code: $(response.status)")
4141
println("Response Body: \n$(String(response.body))")
4242
""";
4343
expect(
@@ -54,12 +54,12 @@ println("Response Body: \n$(String(response.body))")
5454
url = "https://api.apidash.dev/country/data"
5555
5656
params = Dict(
57-
"code" => "IND",
57+
"code" =>["IND","US"],
5858
)
5959
6060
response = HTTP.request("GET", url, query=params, status_exception=false)
6161
62-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
62+
println("Status Code: $(response.status)")
6363
println("Response Body: \n$(String(response.body))")
6464
""";
6565
expect(
@@ -76,16 +76,16 @@ println("Response Body: \n$(String(response.body))")
7676
url = "https://api.apidash.dev/humanize/social"
7777
7878
params = Dict(
79-
"num" => "8700000",
80-
"digits" => "3",
81-
"system" => "SS",
82-
"add_space" => "true",
83-
"trailing_zeros" => "true",
79+
"num" =>["8700000"],
80+
"digits" =>["3"],
81+
"system" =>["SS"],
82+
"add_space" =>["true"],
83+
"trailing_zeros" =>["true"],
8484
)
8585
8686
response = HTTP.request("GET", url, query=params, status_exception=false)
8787
88-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
88+
println("Status Code: $(response.status)")
8989
println("Response Body: \n$(String(response.body))")
9090
""";
9191
expect(
@@ -108,7 +108,7 @@ headers = Dict(
108108
109109
response = HTTP.request("GET", url, headers=headers, status_exception=false)
110110
111-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
111+
println("Status Code: $(response.status)")
112112
println("Response Body: \n$(String(response.body))")
113113
""";
114114
expect(
@@ -126,7 +126,7 @@ println("Response Body: \n$(String(response.body))")
126126
url = "https://api.github.com/repos/foss42/apidash"
127127
128128
params = Dict(
129-
"raw" => "true",
129+
"raw" =>["true"],
130130
)
131131
132132
headers = Dict(
@@ -135,7 +135,7 @@ headers = Dict(
135135
136136
response = HTTP.request("GET", url, headers=headers, query=params, status_exception=false)
137137
138-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
138+
println("Status Code: $(response.status)")
139139
println("Response Body: \n$(String(response.body))")
140140
""";
141141
expect(
@@ -154,7 +154,7 @@ url = "https://api.apidash.dev"
154154
155155
response = HTTP.request("GET", url, status_exception=false)
156156
157-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
157+
println("Status Code: $(response.status)")
158158
println("Response Body: \n$(String(response.body))")
159159
""";
160160
expect(
@@ -172,7 +172,7 @@ println("Response Body: \n$(String(response.body))")
172172
url = "https://api.github.com/repos/foss42/apidash"
173173
174174
params = Dict(
175-
"raw" => "true",
175+
"raw" =>["true"],
176176
)
177177
178178
headers = Dict(
@@ -181,7 +181,7 @@ headers = Dict(
181181
182182
response = HTTP.request("GET", url, headers=headers, query=params, status_exception=false)
183183
184-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
184+
println("Status Code: $(response.status)")
185185
println("Response Body: \n$(String(response.body))")
186186
""";
187187
expect(
@@ -199,13 +199,13 @@ println("Response Body: \n$(String(response.body))")
199199
url = "https://api.apidash.dev/humanize/social"
200200
201201
params = Dict(
202-
"num" => "8700000",
203-
"add_space" => "true",
202+
"num" =>["8700000"],
203+
"add_space" =>["true"],
204204
)
205205
206206
response = HTTP.request("GET", url, query=params, status_exception=false)
207207
208-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
208+
println("Status Code: $(response.status)")
209209
println("Response Body: \n$(String(response.body))")
210210
""";
211211
expect(
@@ -228,7 +228,7 @@ headers = Dict(
228228
229229
response = HTTP.request("GET", url, headers=headers, status_exception=false)
230230
231-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
231+
println("Status Code: $(response.status)")
232232
println("Response Body: \n$(String(response.body))")
233233
""";
234234
expect(
@@ -246,8 +246,8 @@ println("Response Body: \n$(String(response.body))")
246246
url = "https://api.apidash.dev/humanize/social"
247247
248248
params = Dict(
249-
"num" => "8700000",
250-
"digits" => "3",
249+
"num" =>["8700000"],
250+
"digits" =>["3"],
251251
)
252252
253253
headers = Dict(
@@ -256,7 +256,7 @@ headers = Dict(
256256
257257
response = HTTP.request("GET", url, headers=headers, query=params, status_exception=false)
258258
259-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
259+
println("Status Code: $(response.status)")
260260
println("Response Body: \n$(String(response.body))")
261261
""";
262262
expect(
@@ -275,7 +275,7 @@ url = "https://api.apidash.dev/humanize/social"
275275
276276
response = HTTP.request("GET", url, status_exception=false)
277277
278-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
278+
println("Status Code: $(response.status)")
279279
println("Response Body: \n$(String(response.body))")
280280
""";
281281
expect(
@@ -296,7 +296,7 @@ url = "https://api.apidash.dev"
296296
297297
response = HTTP.request("HEAD", url, status_exception=false)
298298
299-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
299+
println("Status Code: $(response.status)")
300300
println("Response Body: \n$(String(response.body))")
301301
""";
302302
expect(
@@ -315,7 +315,7 @@ url = "http://api.apidash.dev"
315315
316316
response = HTTP.request("HEAD", url, status_exception=false)
317317
318-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
318+
println("Status Code: $(response.status)")
319319
println("Response Body: \n$(String(response.body))")
320320
""";
321321
expect(
@@ -344,7 +344,7 @@ headers = Dict(
344344
345345
response = HTTP.request("POST", url, headers=headers, body=payload, status_exception=false)
346346
347-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
347+
println("Status Code: $(response.status)")
348348
println("Response Body: \n$(String(response.body))")
349349
''';
350350
expect(
@@ -376,7 +376,7 @@ headers = Dict(
376376
377377
response = HTTP.request("POST", url, headers=headers, body=payload, status_exception=false)
378378
379-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
379+
println("Status Code: $(response.status)")
380380
println("Response Body: \n$(String(response.body))")
381381
''';
382382
expect(
@@ -403,7 +403,7 @@ headers = Dict(
403403
404404
response = HTTP.request("POST", url, headers=headers, body=payload, status_exception=false)
405405
406-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
406+
println("Status Code: $(response.status)")
407407
println("Response Body: \n$(String(response.body))")
408408
''';
409409
expect(
@@ -430,7 +430,7 @@ payload = HTTP.Form(data)
430430
431431
response = HTTP.request("POST", url, body=payload, status_exception=false)
432432
433-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
433+
println("Status Code: $(response.status)")
434434
println("Response Body: \n$(String(response.body))")
435435
""";
436436
expect(
@@ -461,7 +461,7 @@ headers = Dict(
461461
462462
response = HTTP.request("POST", url, headers=headers, body=payload, status_exception=false)
463463
464-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
464+
println("Status Code: $(response.status)")
465465
println("Response Body: \n$(String(response.body))")
466466
""";
467467
expect(
@@ -486,7 +486,7 @@ payload = HTTP.Form(data)
486486
487487
response = HTTP.request("POST", url, body=payload, status_exception=false)
488488
489-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
489+
println("Status Code: $(response.status)")
490490
println("Response Body: \n$(String(response.body))")
491491
""";
492492
expect(
@@ -511,7 +511,7 @@ payload = HTTP.Form(data)
511511
512512
response = HTTP.request("POST", url, body=payload, status_exception=false)
513513
514-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
514+
println("Status Code: $(response.status)")
515515
println("Response Body: \n$(String(response.body))")
516516
""";
517517
expect(
@@ -528,8 +528,8 @@ println("Response Body: \n$(String(response.body))")
528528
url = "https://api.apidash.dev/io/form"
529529
530530
params = Dict(
531-
"size" => "2",
532-
"len" => "3",
531+
"size" =>["2"],
532+
"len" =>["3"],
533533
)
534534
535535
data = Dict(
@@ -542,7 +542,7 @@ payload = HTTP.Form(data)
542542
543543
response = HTTP.request("POST", url, body=payload, query=params, status_exception=false)
544544
545-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
545+
println("Status Code: $(response.status)")
546546
println("Response Body: \n$(String(response.body))")
547547
""";
548548
expect(
@@ -559,8 +559,8 @@ println("Response Body: \n$(String(response.body))")
559559
url = "https://api.apidash.dev/io/img"
560560
561561
params = Dict(
562-
"size" => "2",
563-
"len" => "3",
562+
"size" =>["2"],
563+
"len" =>["3"],
564564
)
565565
566566
data = Dict(
@@ -577,7 +577,7 @@ headers = Dict(
577577
578578
response = HTTP.request("POST", url, headers=headers, body=payload, query=params, status_exception=false)
579579
580-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
580+
println("Status Code: $(response.status)")
581581
println("Response Body: \n$(String(response.body))")
582582
""";
583583
expect(
@@ -601,12 +601,13 @@ payload = """{
601601
}"""
602602
603603
headers = Dict(
604+
"x-api-key" => "reqres-free-v1",
604605
"content-type" => "application/json",
605606
)
606607
607608
response = HTTP.request("PUT", url, headers=headers, body=payload, status_exception=false)
608609
609-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
610+
println("Status Code: $(response.status)")
610611
println("Response Body: \n$(String(response.body))")
611612
''';
612613
expect(
@@ -630,12 +631,13 @@ payload = """{
630631
}"""
631632
632633
headers = Dict(
634+
"x-api-key" => "reqres-free-v1",
633635
"content-type" => "application/json",
634636
)
635637
636638
response = HTTP.request("PATCH", url, headers=headers, body=payload, status_exception=false)
637639
638-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
640+
println("Status Code: $(response.status)")
639641
println("Response Body: \n$(String(response.body))")
640642
''';
641643
expect(
@@ -653,9 +655,13 @@ println("Response Body: \n$(String(response.body))")
653655
654656
url = "https://reqres.in/api/users/2"
655657
656-
response = HTTP.request("DELETE", url, status_exception=false)
658+
headers = Dict(
659+
"x-api-key" => "reqres-free-v1",
660+
)
661+
662+
response = HTTP.request("DELETE", url, headers=headers, status_exception=false)
657663
658-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
664+
println("Status Code: $(response.status)")
659665
println("Response Body: \n$(String(response.body))")
660666
""";
661667
expect(
@@ -677,12 +683,13 @@ payload = """{
677683
}"""
678684
679685
headers = Dict(
686+
"x-api-key" => "reqres-free-v1",
680687
"content-type" => "application/json",
681688
)
682689
683690
response = HTTP.request("DELETE", url, headers=headers, body=payload, status_exception=false)
684691
685-
println("Status Code: $(response.status) $(HTTP.StatusCodes.statustext(response.status))")
692+
println("Status Code: $(response.status)")
686693
println("Response Body: \n$(String(response.body))")
687694
''';
688695
expect(

0 commit comments

Comments
 (0)