|
1 |
| -import 'package:apidash/models/models.dart' show NameValueModel, RequestModel; |
| 1 | +import 'package:apidash/models/models.dart' |
| 2 | + show FormDataModel, NameValueModel, RequestModel; |
2 | 3 | import 'package:apidash/consts.dart';
|
3 | 4 |
|
4 | 5 | /// Basic GET request model
|
@@ -226,6 +227,105 @@ const requestModelPost3 = RequestModel(
|
226 | 227 | ],
|
227 | 228 | );
|
228 | 229 |
|
| 230 | +/// POST request model with multipart body(text) |
| 231 | +const requestModelPost4 = RequestModel( |
| 232 | + id: 'post4', |
| 233 | + url: 'https://api.apidash.dev/io/form', |
| 234 | + method: HTTPVerb.post, |
| 235 | + requestFormDataList: [ |
| 236 | + FormDataModel(name: "text", value: "API", type: FormDataType.text), |
| 237 | + FormDataModel(name: "sep", value: "|", type: FormDataType.text), |
| 238 | + FormDataModel(name: "times", value: "3", type: FormDataType.text), |
| 239 | + ], |
| 240 | + requestBodyContentType: ContentType.formdata, |
| 241 | +); |
| 242 | + |
| 243 | +/// POST request model with multipart body and headers |
| 244 | +const requestModelPost5 = RequestModel( |
| 245 | + id: 'post5', |
| 246 | + url: 'https://api.apidash.dev/io/form', |
| 247 | + method: HTTPVerb.post, |
| 248 | + requestFormDataList: [ |
| 249 | + FormDataModel(name: "text", value: "API", type: FormDataType.text), |
| 250 | + FormDataModel(name: "sep", value: "|", type: FormDataType.text), |
| 251 | + FormDataModel(name: "times", value: "3", type: FormDataType.text), |
| 252 | + ], |
| 253 | + requestHeaders: [ |
| 254 | + NameValueModel(name: 'User-Agent', value: 'Test Agent'), |
| 255 | + ], |
| 256 | + requestBodyContentType: ContentType.formdata, |
| 257 | +); |
| 258 | + |
| 259 | +/// POST request model with multipart body(text, file) |
| 260 | +const requestModelPost6 = RequestModel( |
| 261 | + id: 'post6', |
| 262 | + url: 'https://api.apidash.dev/io/img', |
| 263 | + method: HTTPVerb.post, |
| 264 | + requestFormDataList: [ |
| 265 | + FormDataModel(name: "token", value: "xyz", type: FormDataType.text), |
| 266 | + FormDataModel( |
| 267 | + name: "imfile", value: "/Documents/up/1.png", type: FormDataType.file), |
| 268 | + ], |
| 269 | + requestBodyContentType: ContentType.formdata, |
| 270 | +); |
| 271 | + |
| 272 | +/// POST request model with multipart body and requestBody (the requestBody shouldn't be in codegen) |
| 273 | +const requestModelPost7 = RequestModel( |
| 274 | + id: 'post7', |
| 275 | + url: 'https://api.apidash.dev/io/img', |
| 276 | + method: HTTPVerb.post, |
| 277 | + requestBody: r"""{ |
| 278 | +"text": "I LOVE Flutter" |
| 279 | +}""", |
| 280 | + requestFormDataList: [ |
| 281 | + FormDataModel(name: "token", value: "xyz", type: FormDataType.text), |
| 282 | + FormDataModel( |
| 283 | + name: "imfile", value: "/Documents/up/1.png", type: FormDataType.file), |
| 284 | + ], |
| 285 | + requestBodyContentType: ContentType.formdata, |
| 286 | +); |
| 287 | + |
| 288 | +/// POST request model with multipart body and requestParams |
| 289 | +const requestModelPost8 = RequestModel( |
| 290 | + id: 'post8', |
| 291 | + url: 'https://api.apidash.dev/io/form', |
| 292 | + method: HTTPVerb.post, |
| 293 | + requestFormDataList: [ |
| 294 | + FormDataModel(name: "text", value: "API", type: FormDataType.text), |
| 295 | + FormDataModel(name: "sep", value: "|", type: FormDataType.text), |
| 296 | + FormDataModel(name: "times", value: "3", type: FormDataType.text), |
| 297 | + ], |
| 298 | + requestParams: [ |
| 299 | + NameValueModel(name: 'size', value: '2'), |
| 300 | + NameValueModel(name: 'len', value: '3'), |
| 301 | + ], |
| 302 | + requestBodyContentType: ContentType.formdata, |
| 303 | +); |
| 304 | + |
| 305 | +/// POST request model with multipart body(file and text), requestParams, requestHeaders and requestBody |
| 306 | +const requestModelPost9 = RequestModel( |
| 307 | + id: 'post9', |
| 308 | + url: 'https://api.apidash.dev/io/img', |
| 309 | + method: HTTPVerb.post, |
| 310 | + requestBody: r"""{ |
| 311 | +"text": "I LOVE Flutter" |
| 312 | +}""", |
| 313 | + requestFormDataList: [ |
| 314 | + FormDataModel(name: "token", value: "xyz", type: FormDataType.text), |
| 315 | + FormDataModel( |
| 316 | + name: "imfile", value: "/Documents/up/1.png", type: FormDataType.file), |
| 317 | + ], |
| 318 | + requestParams: [ |
| 319 | + NameValueModel(name: 'size', value: '2'), |
| 320 | + NameValueModel(name: 'len', value: '3'), |
| 321 | + ], |
| 322 | + requestHeaders: [ |
| 323 | + NameValueModel(name: 'User-Agent', value: 'Test Agent'), |
| 324 | + NameValueModel(name: 'Keep-Alive', value: 'true'), |
| 325 | + ], |
| 326 | + requestBodyContentType: ContentType.formdata, |
| 327 | +); |
| 328 | + |
229 | 329 | /// PUT request model
|
230 | 330 | const requestModelPut1 = RequestModel(
|
231 | 331 | id: 'put1',
|
|
0 commit comments