File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
androidTest/java/com/google/firebase/functions
main/java/com/google/firebase/functions Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -98,10 +98,12 @@ class CallTests {
98
98
.addHeader(" Header1" , " value1" )
99
99
.addHeader(" Header2" , " value2" )
100
100
.addHeader(" Header1" , " value3" )
101
+ .addHeaders(mapOf (" Header3" to " value4" ))
101
102
val actual = Tasks .await(function.call()).getData() as ? Map <* , * >
102
103
103
104
assertThat(actual).isNotNull()
104
105
assertThat(actual?.get(" Header1" )).isEqualTo(" value3" )
105
106
assertThat(actual?.get(" Header2" )).isEqualTo(" value2" )
107
+ assertThat(actual?.get(" Header3" )).isEqualTo(" value4" )
106
108
}
107
109
}
Original file line number Diff line number Diff line change @@ -185,4 +185,16 @@ public class HttpsCallableReference {
185
185
headers[name] = value
186
186
return this
187
187
}
188
+
189
+ /* *
190
+ * Adds all HTTP headers of passed map for calls from this instance of Functions.
191
+ *
192
+ * Note that an existing header with the same name will be overwritten.
193
+ *
194
+ * @param headers Map of HTTP headers (name to value)
195
+ */
196
+ public fun addHeaders (headers : Map <String , String >): HttpsCallableReference {
197
+ this .headers.putAll(headers)
198
+ return this
199
+ }
188
200
}
You can’t perform that action at this time.
0 commit comments