@@ -28,6 +28,9 @@ public class ScreenRecordingUploadOptions {
2828 private String user ;
2929 private String pass ;
3030 private String method ;
31+ private String fileFieldName ;
32+ private Map <String , String > headers ;
33+ private Map <String , Object > formFields ;
3134
3235 public static ScreenRecordingUploadOptions uploadOptions () {
3336 return new ScreenRecordingUploadOptions ();
@@ -74,6 +77,45 @@ public ScreenRecordingUploadOptions withHttpMethod(RequestMethod method) {
7477 return this ;
7578 }
7679
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+
77119 /**
78120 * Builds a map, which is ready to be passed to the subordinated
79121 * Appium API.
@@ -86,6 +128,9 @@ public Map<String, Object> build() {
86128 ofNullable (user ).map (x -> builder .put ("user" , x ));
87129 ofNullable (pass ).map (x -> builder .put ("pass" , x ));
88130 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 ));
89134 return builder .build ();
90135 }
91136}
0 commit comments