@@ -28,6 +28,9 @@ public class ScreenRecordingUploadOptions {
28
28
private String user ;
29
29
private String pass ;
30
30
private String method ;
31
+ private String fileFieldName ;
32
+ private Map <String , String > headers ;
33
+ private Map <String , Object > formFields ;
31
34
32
35
public static ScreenRecordingUploadOptions uploadOptions () {
33
36
return new ScreenRecordingUploadOptions ();
@@ -74,6 +77,45 @@ public ScreenRecordingUploadOptions withHttpMethod(RequestMethod method) {
74
77
return this ;
75
78
}
76
79
80
+ /**
81
+ * Sets the form field name containing the binary payload in multipart/form-data
82
+ * requests.
83
+ *
84
+ * @since Appium 1.18.0
85
+ * @param fileFieldName The name of the form field containing the binary payload.
86
+ * "file" by default.
87
+ * @return self instance for chaining.
88
+ */
89
+ public ScreenRecordingUploadOptions withFileFieldName (String fileFieldName ) {
90
+ this .fileFieldName = checkNotNull (fileFieldName );
91
+ return this ;
92
+ }
93
+
94
+ /**
95
+ * Sets additional form fields in multipart/form-data requests.
96
+ *
97
+ * @since Appium 1.18.0
98
+ * @param formFields form fields mapping. If any entry has the same key as
99
+ * `fileFieldName` then it is going to be ignored.
100
+ * @return self instance for chaining.
101
+ */
102
+ public ScreenRecordingUploadOptions withFormFields (Map <String , Object > formFields ) {
103
+ this .formFields = checkNotNull (formFields );
104
+ return this ;
105
+ }
106
+
107
+ /**
108
+ * Sets additional headers in multipart/form-data requests.
109
+ *
110
+ * @since Appium 1.18.0
111
+ * @param headers headers mapping.
112
+ * @return self instance for chaining.
113
+ */
114
+ public ScreenRecordingUploadOptions withHeaders (Map <String , String > headers ) {
115
+ this .headers = checkNotNull (headers );
116
+ return this ;
117
+ }
118
+
77
119
/**
78
120
* Builds a map, which is ready to be passed to the subordinated
79
121
* Appium API.
@@ -86,6 +128,9 @@ public Map<String, Object> build() {
86
128
ofNullable (user ).map (x -> builder .put ("user" , x ));
87
129
ofNullable (pass ).map (x -> builder .put ("pass" , x ));
88
130
ofNullable (method ).map (x -> builder .put ("method" , x ));
131
+ ofNullable (fileFieldName ).map (x -> builder .put ("fileFieldName" , x ));
132
+ ofNullable (formFields ).map (x -> builder .put ("formFields" , x ));
133
+ ofNullable (headers ).map (x -> builder .put ("headers" , x ));
89
134
return builder .build ();
90
135
}
91
136
}
0 commit comments