@typespec/http-specs 0.1.0-dev.0 → 0.1.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@typespec/http-specs",
3
3
  "displayName": "Http Specs",
4
- "version": "0.1.0-dev.0",
4
+ "version": "0.1.0-dev.2",
5
5
  "description": "Spec scenarios and mock apis",
6
6
  "main": "dist/index.js",
7
7
  "type": "module",
@@ -22,27 +22,27 @@
22
22
  },
23
23
  "homepage": "https://github.com/microsoft/typespec#readme",
24
24
  "dependencies": {
25
- "@typespec/spec-api": "^0.1.0-alpha.13 || >= 0.1.0-dev.0",
26
- "@typespec/spector": "^0.1.0-alpha.24 || >= 0.1.0-dev.0",
27
- "deep-equal": "^2.2.0"
25
+ "@typespec/spec-api": "^0.1.0-alpha.13 || >= 0.1.0-alpha.14-dev.3",
26
+ "@typespec/spector": "^0.1.0-alpha.24 || >= 0.1.0-dev.3",
27
+ "deep-equal": "^2.2.3"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/deep-equal": "^1.0.1",
31
- "@types/multer": "^2.0.0",
32
- "@types/node": "~25.3.0",
33
- "@typespec/json-schema": "^1.10.0 || >= 1.11.0-dev.0",
34
- "@typespec/openapi": "^1.10.0 || >= 1.11.0-dev.0",
35
- "@typespec/openapi3": "^1.10.0 || >= 1.11.0-dev.0",
36
- "concurrently": "^9.1.2",
30
+ "@types/deep-equal": "^1.0.4",
31
+ "@types/multer": "^2.1.0",
32
+ "@types/node": "~25.5.0",
33
+ "@typespec/json-schema": "^1.10.0 || >= 1.11.0-dev.2",
34
+ "@typespec/openapi": "^1.10.0 || >= 1.11.0-dev.2",
35
+ "@typespec/openapi3": "^1.10.0 || >= 1.11.0-dev.4",
36
+ "concurrently": "^9.2.1",
37
37
  "rimraf": "~6.1.3",
38
38
  "typescript": "~5.9.3"
39
39
  },
40
40
  "peerDependencies": {
41
- "@typespec/compiler": "^1.10.0 || >= 1.11.0-dev.0",
42
- "@typespec/http": "^1.10.0 || >= 1.11.0-dev.0",
43
- "@typespec/rest": "^0.80.0 || >= 0.81.0-dev.0",
44
- "@typespec/versioning": "^0.80.0 || >= 0.81.0-dev.0",
45
- "@typespec/xml": "^0.80.0 || >= 0.81.0-dev.0"
41
+ "@typespec/compiler": "^1.10.0 || >= 1.11.0-dev.6",
42
+ "@typespec/http": "^1.10.0 || >= 1.11.0-dev.3",
43
+ "@typespec/rest": "^0.80.0 || >= 0.81.0-dev.2",
44
+ "@typespec/versioning": "^0.80.0 || >= 0.81.0-dev.2",
45
+ "@typespec/xml": "^0.80.0 || >= 0.81.0-dev.2"
46
46
  },
47
47
  "scripts": {
48
48
  "watch": "tsc -p ./tsconfig.build.json --watch",
@@ -58,7 +58,7 @@
58
58
  "upload-coverage": "tsp-spector upload-coverage --generatorName @typespec/http-specs --generatorVersion 0.1.0-alpha.4 --containerName coverages --generatorMode standard --storageAccountName typespec",
59
59
  "validate-mock-apis": "tsp-spector validate-mock-apis ./specs",
60
60
  "check-scenario-coverage": "tsp-spector check-coverage ./specs",
61
- "validate-client-server": "concurrently \"tsp-spector server start ./specs\" \"pnpm knock\"; tsp-spector server stop",
61
+ "validate-client-server": "concurrently \"tsp-spector server start ./specs\" \"pnpm knock\"; code=$?; tsp-spector server stop; exit $code",
62
62
  "build:smoke": "tsp compile smoke/petstore --warn-as-error --no-emit && tsp compile smoke/todoapp --warn-as-error --no-emit",
63
63
  "client": "pnpm knock",
64
64
  "knock": "tsp-spector knock ./specs",
package/spec-summary.md CHANGED
@@ -2509,6 +2509,48 @@ Expected response body:
2509
2509
  }
2510
2510
  ```
2511
2511
 
2512
+ ### Payload_Pageable_ServerDrivenPagination_AlternateInitialVerb_post
2513
+
2514
+ - Endpoint: `post /payload/pageable/server-driven-pagination/link/initial-post`
2515
+
2516
+ Test case for initial POST request followed by GET for next pages using link pagination.
2517
+ The initial request is a POST with a filter body, and the next page is fetched using a GET request on the next link.
2518
+
2519
+ Two requests need to be tested.
2520
+
2521
+ 1. Initial request (POST):
2522
+ Expected route: /payload/pageable/server-driven-pagination/link/initial-post
2523
+ Expected request body:
2524
+
2525
+ ```json
2526
+ { "filter": "foo eq bar" }
2527
+ ```
2528
+
2529
+ Expected response body:
2530
+
2531
+ ```json
2532
+ {
2533
+ "pets": [
2534
+ { "id": "1", "name": "dog" },
2535
+ { "id": "2", "name": "cat" }
2536
+ ],
2537
+ "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc"
2538
+ }
2539
+ ```
2540
+
2541
+ 2. Next page request (GET):
2542
+ Expected route: /payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc
2543
+ Expected response body:
2544
+
2545
+ ```json
2546
+ {
2547
+ "pets": [
2548
+ { "id": "3", "name": "bird" },
2549
+ { "id": "4", "name": "fish" }
2550
+ ]
2551
+ }
2552
+ ```
2553
+
2512
2554
  ### Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderNestedResponseBody
2513
2555
 
2514
2556
  - Endpoint: `get /payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body`
@@ -3207,6 +3249,90 @@ Expected request body:
3207
3249
  </ModelWithEnum>
3208
3250
  ```
3209
3251
 
3252
+ ### Payload_Xml_ModelWithNamespaceOnPropertiesValue_get
3253
+
3254
+ - Endpoint: `get /payload/xml/modelWithNamespaceOnProperties`
3255
+
3256
+ Expected response body:
3257
+
3258
+ ```xml
3259
+ <smp:ModelWithNamespaceOnProperties xmlns:smp="http://example.com/schema" xmlns:ns2="http://example.com/ns2">
3260
+ <id>123</id>
3261
+ <smp:title>The Great Gatsby</smp:title>
3262
+ <ns2:author>F. Scott Fitzgerald</ns2:author>
3263
+ </smp:ModelWithNamespaceOnProperties>
3264
+ ```
3265
+
3266
+ ### Payload_Xml_ModelWithNamespaceOnPropertiesValue_put
3267
+
3268
+ - Endpoint: `put /payload/xml/modelWithNamespaceOnProperties`
3269
+
3270
+ Expected request body:
3271
+
3272
+ ```xml
3273
+ <smp:ModelWithNamespaceOnProperties xmlns:smp="http://example.com/schema" xmlns:ns2="http://example.com/ns2">
3274
+ <id>123</id>
3275
+ <smp:title>The Great Gatsby</smp:title>
3276
+ <ns2:author>F. Scott Fitzgerald</ns2:author>
3277
+ </smp:ModelWithNamespaceOnProperties>
3278
+ ```
3279
+
3280
+ ### Payload_Xml_ModelWithNamespaceValue_get
3281
+
3282
+ - Endpoint: `get /payload/xml/modelWithNamespace`
3283
+
3284
+ Expected response body:
3285
+
3286
+ ```xml
3287
+ <smp:ModelWithNamespace xmlns:smp="http://example.com/schema">
3288
+ <id>123</id>
3289
+ <title>The Great Gatsby</title>
3290
+ </smp:ModelWithNamespace>
3291
+ ```
3292
+
3293
+ ### Payload_Xml_ModelWithNamespaceValue_put
3294
+
3295
+ - Endpoint: `put /payload/xml/modelWithNamespace`
3296
+
3297
+ Expected request body:
3298
+
3299
+ ```xml
3300
+ <smp:ModelWithNamespace xmlns:smp="http://example.com/schema">
3301
+ <id>123</id>
3302
+ <title>The Great Gatsby</title>
3303
+ </smp:ModelWithNamespace>
3304
+ ```
3305
+
3306
+ ### Payload_Xml_ModelWithNestedModelValue_get
3307
+
3308
+ - Endpoint: `get /payload/xml/modelWithNestedModel`
3309
+
3310
+ Expected response body:
3311
+
3312
+ ```xml
3313
+ <ModelWithNestedModel>
3314
+ <nested>
3315
+ <name>foo</name>
3316
+ <age>123</age>
3317
+ </nested>
3318
+ </ModelWithNestedModel>
3319
+ ```
3320
+
3321
+ ### Payload_Xml_ModelWithNestedModelValue_put
3322
+
3323
+ - Endpoint: `put /payload/xml/modelWithNestedModel`
3324
+
3325
+ Expected request body:
3326
+
3327
+ ```xml
3328
+ <ModelWithNestedModel>
3329
+ <nested>
3330
+ <name>foo</name>
3331
+ <age>123</age>
3332
+ </nested>
3333
+ </ModelWithNestedModel>
3334
+ ```
3335
+
3210
3336
  ### Payload_Xml_ModelWithOptionalFieldValue_get
3211
3337
 
3212
3338
  - Endpoint: `get /payload/xml/modelWithOptionalField`
@@ -3267,6 +3393,32 @@ Expected request body:
3267
3393
  </ModelWithRenamedArrays>
3268
3394
  ```
3269
3395
 
3396
+ ### Payload_Xml_ModelWithRenamedAttributeValue_get
3397
+
3398
+ - Endpoint: `get /payload/xml/modelWithRenamedAttribute`
3399
+
3400
+ Expected response body:
3401
+
3402
+ ```xml
3403
+ <ModelWithRenamedAttribute xml-id="123">
3404
+ <title>The Great Gatsby</title>
3405
+ <author>F. Scott Fitzgerald</author>
3406
+ </ModelWithRenamedAttribute>
3407
+ ```
3408
+
3409
+ ### Payload_Xml_ModelWithRenamedAttributeValue_put
3410
+
3411
+ - Endpoint: `put /payload/xml/modelWithRenamedAttribute`
3412
+
3413
+ Expected request body:
3414
+
3415
+ ```xml
3416
+ <ModelWithRenamedAttribute xml-id="123">
3417
+ <title>The Great Gatsby</title>
3418
+ <author>F. Scott Fitzgerald</author>
3419
+ </ModelWithRenamedAttribute>
3420
+ ```
3421
+
3270
3422
  ### Payload_Xml_ModelWithRenamedFieldsValue_get
3271
3423
 
3272
3424
  - Endpoint: `get /payload/xml/modelWithRenamedFields`
@@ -3305,6 +3457,178 @@ Expected request body:
3305
3457
  </ModelWithRenamedFieldsSrc>
3306
3458
  ```
3307
3459
 
3460
+ ### Payload_Xml_ModelWithRenamedNestedModelValue_get
3461
+
3462
+ - Endpoint: `get /payload/xml/modelWithRenamedNestedModel`
3463
+
3464
+ Expected response body:
3465
+
3466
+ ```xml
3467
+ <ModelWithRenamedNestedModel>
3468
+ <author>
3469
+ <name>foo</name>
3470
+ </author>
3471
+ </ModelWithRenamedNestedModel>
3472
+ ```
3473
+
3474
+ ### Payload_Xml_ModelWithRenamedNestedModelValue_put
3475
+
3476
+ - Endpoint: `put /payload/xml/modelWithRenamedNestedModel`
3477
+
3478
+ Expected request body:
3479
+
3480
+ ```xml
3481
+ <ModelWithRenamedNestedModel>
3482
+ <author>
3483
+ <name>foo</name>
3484
+ </author>
3485
+ </ModelWithRenamedNestedModel>
3486
+ ```
3487
+
3488
+ ### Payload_Xml_ModelWithRenamedPropertyValue_get
3489
+
3490
+ - Endpoint: `get /payload/xml/modelWithRenamedProperty`
3491
+
3492
+ Expected response body:
3493
+
3494
+ ```xml
3495
+ <ModelWithRenamedProperty>
3496
+ <renamedTitle>foo</renamedTitle>
3497
+ <author>bar</author>
3498
+ </ModelWithRenamedProperty>
3499
+ ```
3500
+
3501
+ ### Payload_Xml_ModelWithRenamedPropertyValue_put
3502
+
3503
+ - Endpoint: `put /payload/xml/modelWithRenamedProperty`
3504
+
3505
+ Expected request body:
3506
+
3507
+ ```xml
3508
+ <ModelWithRenamedProperty>
3509
+ <renamedTitle>foo</renamedTitle>
3510
+ <author>bar</author>
3511
+ </ModelWithRenamedProperty>
3512
+ ```
3513
+
3514
+ ### Payload_Xml_ModelWithRenamedUnwrappedModelArrayValue_get
3515
+
3516
+ - Endpoint: `get /payload/xml/modelWithRenamedUnwrappedModelArray`
3517
+
3518
+ Expected response body:
3519
+
3520
+ ```xml
3521
+ <ModelWithRenamedUnwrappedModelArray>
3522
+ <ModelItem>
3523
+ <name>foo</name>
3524
+ <age>123</age>
3525
+ </ModelItem>
3526
+ <ModelItem>
3527
+ <name>bar</name>
3528
+ <age>456</age>
3529
+ </ModelItem>
3530
+ </ModelWithRenamedUnwrappedModelArray>
3531
+ ```
3532
+
3533
+ ### Payload_Xml_ModelWithRenamedUnwrappedModelArrayValue_put
3534
+
3535
+ - Endpoint: `put /payload/xml/modelWithRenamedUnwrappedModelArray`
3536
+
3537
+ Expected request body:
3538
+
3539
+ ```xml
3540
+ <ModelWithRenamedUnwrappedModelArray>
3541
+ <ModelItem>
3542
+ <name>foo</name>
3543
+ <age>123</age>
3544
+ </ModelItem>
3545
+ <ModelItem>
3546
+ <name>bar</name>
3547
+ <age>456</age>
3548
+ </ModelItem>
3549
+ </ModelWithRenamedUnwrappedModelArray>
3550
+ ```
3551
+
3552
+ ### Payload_Xml_ModelWithRenamedWrappedAndItemModelArrayValue_get
3553
+
3554
+ - Endpoint: `get /payload/xml/modelWithRenamedWrappedAndItemModelArray`
3555
+
3556
+ Expected response body:
3557
+
3558
+ ```xml
3559
+ <ModelWithRenamedWrappedAndItemModelArray>
3560
+ <AllBooks>
3561
+ <XmlBook>
3562
+ <title>The Great Gatsby</title>
3563
+ </XmlBook>
3564
+ <XmlBook>
3565
+ <title>Les Miserables</title>
3566
+ </XmlBook>
3567
+ </AllBooks>
3568
+ </ModelWithRenamedWrappedAndItemModelArray>
3569
+ ```
3570
+
3571
+ ### Payload_Xml_ModelWithRenamedWrappedAndItemModelArrayValue_put
3572
+
3573
+ - Endpoint: `put /payload/xml/modelWithRenamedWrappedAndItemModelArray`
3574
+
3575
+ Expected request body:
3576
+
3577
+ ```xml
3578
+ <ModelWithRenamedWrappedAndItemModelArray>
3579
+ <AllBooks>
3580
+ <XmlBook>
3581
+ <title>The Great Gatsby</title>
3582
+ </XmlBook>
3583
+ <XmlBook>
3584
+ <title>Les Miserables</title>
3585
+ </XmlBook>
3586
+ </AllBooks>
3587
+ </ModelWithRenamedWrappedAndItemModelArray>
3588
+ ```
3589
+
3590
+ ### Payload_Xml_ModelWithRenamedWrappedModelArrayValue_get
3591
+
3592
+ - Endpoint: `get /payload/xml/modelWithRenamedWrappedModelArray`
3593
+
3594
+ Expected response body:
3595
+
3596
+ ```xml
3597
+ <ModelWithRenamedWrappedModelArray>
3598
+ <AllItems>
3599
+ <SimpleModel>
3600
+ <name>foo</name>
3601
+ <age>123</age>
3602
+ </SimpleModel>
3603
+ <SimpleModel>
3604
+ <name>bar</name>
3605
+ <age>456</age>
3606
+ </SimpleModel>
3607
+ </AllItems>
3608
+ </ModelWithRenamedWrappedModelArray>
3609
+ ```
3610
+
3611
+ ### Payload_Xml_ModelWithRenamedWrappedModelArrayValue_put
3612
+
3613
+ - Endpoint: `put /payload/xml/modelWithRenamedWrappedModelArray`
3614
+
3615
+ Expected request body:
3616
+
3617
+ ```xml
3618
+ <ModelWithRenamedWrappedModelArray>
3619
+ <AllItems>
3620
+ <SimpleModel>
3621
+ <name>foo</name>
3622
+ <age>123</age>
3623
+ </SimpleModel>
3624
+ <SimpleModel>
3625
+ <name>bar</name>
3626
+ <age>456</age>
3627
+ </SimpleModel>
3628
+ </AllItems>
3629
+ </ModelWithRenamedWrappedModelArray>
3630
+ ```
3631
+
3308
3632
  ### Payload_Xml_ModelWithSimpleArraysValue_get
3309
3633
 
3310
3634
  - Endpoint: `get /payload/xml/modelWithSimpleArrays`
@@ -3405,6 +3729,74 @@ Expected request body:
3405
3729
  </ModelWithUnwrappedArray>
3406
3730
  ```
3407
3731
 
3732
+ ### Payload_Xml_ModelWithUnwrappedModelArrayValue_get
3733
+
3734
+ - Endpoint: `get /payload/xml/modelWithUnwrappedModelArray`
3735
+
3736
+ Expected response body:
3737
+
3738
+ ```xml
3739
+ <ModelWithUnwrappedModelArray>
3740
+ <items>
3741
+ <name>foo</name>
3742
+ <age>123</age>
3743
+ </items>
3744
+ <items>
3745
+ <name>bar</name>
3746
+ <age>456</age>
3747
+ </items>
3748
+ </ModelWithUnwrappedModelArray>
3749
+ ```
3750
+
3751
+ ### Payload_Xml_ModelWithUnwrappedModelArrayValue_put
3752
+
3753
+ - Endpoint: `put /payload/xml/modelWithUnwrappedModelArray`
3754
+
3755
+ Expected request body:
3756
+
3757
+ ```xml
3758
+ <ModelWithUnwrappedModelArray>
3759
+ <items>
3760
+ <name>foo</name>
3761
+ <age>123</age>
3762
+ </items>
3763
+ <items>
3764
+ <name>bar</name>
3765
+ <age>456</age>
3766
+ </items>
3767
+ </ModelWithUnwrappedModelArray>
3768
+ ```
3769
+
3770
+ ### Payload_Xml_ModelWithWrappedPrimitiveCustomItemNamesValue_get
3771
+
3772
+ - Endpoint: `get /payload/xml/modelWithWrappedPrimitiveCustomItemNames`
3773
+
3774
+ Expected response body:
3775
+
3776
+ ```xml
3777
+ <ModelWithWrappedPrimitiveCustomItemNames>
3778
+ <ItemsTags>
3779
+ <ItemName>fiction</ItemName>
3780
+ <ItemName>classic</ItemName>
3781
+ </ItemsTags>
3782
+ </ModelWithWrappedPrimitiveCustomItemNames>
3783
+ ```
3784
+
3785
+ ### Payload_Xml_ModelWithWrappedPrimitiveCustomItemNamesValue_put
3786
+
3787
+ - Endpoint: `put /payload/xml/modelWithWrappedPrimitiveCustomItemNames`
3788
+
3789
+ Expected request body:
3790
+
3791
+ ```xml
3792
+ <ModelWithWrappedPrimitiveCustomItemNames>
3793
+ <ItemsTags>
3794
+ <ItemName>fiction</ItemName>
3795
+ <ItemName>classic</ItemName>
3796
+ </ItemsTags>
3797
+ </ModelWithWrappedPrimitiveCustomItemNames>
3798
+ ```
3799
+
3408
3800
  ### Payload_Xml_SimpleModelValue_get
3409
3801
 
3410
3802
  - Endpoint: `get /payload/xml/simpleModel`
@@ -295,6 +295,11 @@ function createHeaderFloatServerTests(uri: string, value: number) {
295
295
  return passOnSuccess({
296
296
  uri,
297
297
  method: "get",
298
+ request: {
299
+ headers: {
300
+ duration: String(value),
301
+ },
302
+ },
298
303
  response: {
299
304
  status: 204,
300
305
  },
@@ -437,9 +437,11 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileSpecificContentType = passOn
437
437
  uri: "/multipart/form-data/file/specific-content-type",
438
438
  method: "post",
439
439
  request: {
440
- headers: {
441
- "content-type": "multipart/form-data",
442
- },
440
+ body: multipart({
441
+ files: [
442
+ { fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" },
443
+ ],
444
+ }),
443
445
  },
444
446
  response: {
445
447
  status: 204,
@@ -460,9 +462,11 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileRequiredFilename = passOnSuc
460
462
  uri: "/multipart/form-data/file/required-filename",
461
463
  method: "post",
462
464
  request: {
463
- headers: {
464
- "content-type": "multipart/form-data",
465
- },
465
+ body: multipart({
466
+ files: [
467
+ { fieldname: "file", originalname: "image.png", buffer: pngFile, mimetype: "image/png" },
468
+ ],
469
+ }),
466
470
  },
467
471
  response: {
468
472
  status: 204,
@@ -483,9 +487,12 @@ Scenarios.Payload_MultiPart_FormData_File_uploadFileArray = passOnSuccess({
483
487
  uri: "/multipart/form-data/file/file-array",
484
488
  method: "post",
485
489
  request: {
486
- headers: {
487
- "content-type": "multipart/form-data",
488
- },
490
+ body: multipart({
491
+ files: [
492
+ { fieldname: "files", originalname: "image.png", buffer: pngFile, mimetype: "image/png" },
493
+ { fieldname: "files", originalname: "image.png", buffer: pngFile, mimetype: "image/png" },
494
+ ],
495
+ }),
489
496
  },
490
497
  response: {
491
498
  status: 204,
@@ -141,6 +141,53 @@ namespace ServerDrivenPagination {
141
141
  };
142
142
  };
143
143
 
144
+ /** Scenario where the initial request is not a GET request. However following the next link always result in a GET request. */
145
+ namespace AlternateInitialVerb {
146
+ model Filter {
147
+ filter: string;
148
+ }
149
+
150
+ @scenario
151
+ @scenarioDoc("""
152
+ Test case for initial POST request followed by GET for next pages using link pagination.
153
+ The initial request is a POST with a filter body, and the next page is fetched using a GET request on the next link.
154
+
155
+ Two requests need to be tested.
156
+ 1. Initial request (POST):
157
+ Expected route: /payload/pageable/server-driven-pagination/link/initial-post
158
+ Expected request body:
159
+ ```json
160
+ { "filter": "foo eq bar" }
161
+ ```
162
+ Expected response body:
163
+ ```json
164
+ { "pets": [
165
+ { "id": "1", "name": "dog" },
166
+ { "id": "2", "name": "cat" }
167
+ ],
168
+ "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc"
169
+ }
170
+ ```
171
+ 2. Next page request (GET):
172
+ Expected route: /payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc
173
+ Expected response body:
174
+ ```json
175
+ { "pets": [
176
+ { "id": "3", "name": "bird" },
177
+ { "id": "4", "name": "fish" }
178
+ ]
179
+ }
180
+ ```
181
+ """)
182
+ @route("/link/initial-post")
183
+ @list
184
+ @post
185
+ op post(@body body: Filter): {
186
+ @pageItems pets: Pet[];
187
+ @nextLink next?: url;
188
+ };
189
+ }
190
+
144
191
  @route("/continuationtoken")
145
192
  namespace ContinuationToken {
146
193
  @scenario
@@ -4,6 +4,7 @@ import {
4
4
  json,
5
5
  MockRequest,
6
6
  passOnSuccess,
7
+ ResolverConfig,
7
8
  ScenarioMockApi,
8
9
  ValidationError,
9
10
  xml,
@@ -176,6 +177,34 @@ Scenarios.Payload_Pageable_ServerDrivenPagination_nestedLink = passOnSuccess([
176
177
  },
177
178
  ]);
178
179
 
180
+ // POST-THEN-GET LINK PAGINATION
181
+ Scenarios.Payload_Pageable_ServerDrivenPagination_AlternateInitialVerb_post = passOnSuccess([
182
+ {
183
+ uri: "/payload/pageable/server-driven-pagination/link/initial-post",
184
+ method: "post",
185
+ request: {
186
+ body: json({ filter: "foo eq bar" }),
187
+ },
188
+ response: {
189
+ status: 200,
190
+ body: json({
191
+ pets: FirstPage,
192
+ next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc`,
193
+ }),
194
+ },
195
+ kind: "MockApiDefinition",
196
+ },
197
+ {
198
+ uri: "/payload/pageable/server-driven-pagination/link/initial-post/nextPage",
199
+ method: "get",
200
+ request: {
201
+ query: { token: "abc" },
202
+ },
203
+ response: SecondResponse,
204
+ kind: "MockApiDefinition",
205
+ },
206
+ ]);
207
+
179
208
  Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseBody =
180
209
  createTests("query", "body");
181
210
 
@@ -553,7 +582,7 @@ Scenarios.Payload_Pageable_XmlPagination_listWithContinuation = passOnSuccess([
553
582
  status: 200,
554
583
  body: xml(XmlContTokenFirstPage),
555
584
  headers: {
556
- "content-type": "application/xml",
585
+ "content-type": "application/xml; charset=utf-8",
557
586
  },
558
587
  },
559
588
  handler: (req: MockRequest) => {
@@ -590,7 +619,7 @@ Scenarios.Payload_Pageable_XmlPagination_listWithContinuation = passOnSuccess([
590
619
  status: 200,
591
620
  body: xml(XmlContTokenSecondPage),
592
621
  headers: {
593
- "content-type": "application/xml",
622
+ "content-type": "application/xml; charset=utf-8",
594
623
  },
595
624
  },
596
625
  handler: (req: MockRequest) => {
@@ -659,9 +688,15 @@ Scenarios.Payload_Pageable_XmlPagination_listWithNextLink = passOnSuccess([
659
688
  request: {},
660
689
  response: {
661
690
  status: 200,
662
- body: xml(xmlNextLinkFirstPage("PLACEHOLDER_BASE_URL")),
691
+ body: {
692
+ contentType: "application/xml",
693
+ rawContent: {
694
+ serialize: (config: ResolverConfig) =>
695
+ `<?xml version='1.0' encoding='UTF-8'?>` + xmlNextLinkFirstPage(config.baseUrl),
696
+ },
697
+ },
663
698
  headers: {
664
- "content-type": "application/xml",
699
+ "content-type": "application/xml; charset=utf-8",
665
700
  },
666
701
  },
667
702
  handler: (req: MockRequest) => {
@@ -683,7 +718,7 @@ Scenarios.Payload_Pageable_XmlPagination_listWithNextLink = passOnSuccess([
683
718
  status: 200,
684
719
  body: xml(XmlNextLinkSecondPage),
685
720
  headers: {
686
- "content-type": "application/xml",
721
+ "content-type": "application/xml; charset=utf-8",
687
722
  },
688
723
  },
689
724
  kind: "MockApiDefinition",