@@ -316,86 +316,4 @@ final class FunctionsClientTests: XCTestCase {
316
316
sut. setAuth ( token: nil )
317
317
XCTAssertNil ( sut. headers [ . authorization] )
318
318
}
319
-
320
- func testInvokeWithStreamedResponse( ) async throws {
321
- Mock (
322
- url: url. appendingPathComponent ( " stream " ) ,
323
- statusCode: 200 ,
324
- data: [ . post: Data ( " hello world " . utf8) ]
325
- )
326
- . snapshotRequest {
327
- #"""
328
- curl \
329
- --request POST \
330
- --header "X-Client-Info: functions-swift/0.0.0" \
331
- --header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
332
- "http://localhost:5432/functions/v1/stream"
333
- """#
334
- }
335
- . register ( )
336
-
337
- let stream = sut. _invokeWithStreamedResponse ( " stream " )
338
-
339
- for try await value in stream {
340
- XCTAssertEqual ( String ( decoding: value, as: UTF8 . self) , " hello world " )
341
- }
342
- }
343
-
344
- func testInvokeWithStreamedResponseHTTPError( ) async throws {
345
- Mock (
346
- url: url. appendingPathComponent ( " stream " ) ,
347
- statusCode: 300 ,
348
- data: [ . post: Data ( ) ]
349
- )
350
- . snapshotRequest {
351
- #"""
352
- curl \
353
- --request POST \
354
- --header "X-Client-Info: functions-swift/0.0.0" \
355
- --header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
356
- "http://localhost:5432/functions/v1/stream"
357
- """#
358
- }
359
- . register ( )
360
-
361
- let stream = sut. _invokeWithStreamedResponse ( " stream " )
362
-
363
- do {
364
- for try await _ in stream {
365
- XCTFail ( " should throw error " )
366
- }
367
- } catch let FunctionsError . httpError( code, _) {
368
- XCTAssertEqual ( code, 300 )
369
- }
370
- }
371
-
372
- func testInvokeWithStreamedResponseRelayError( ) async throws {
373
- Mock (
374
- url: url. appendingPathComponent ( " stream " ) ,
375
- statusCode: 200 ,
376
- data: [ . post: Data ( ) ] ,
377
- additionalHeaders: [
378
- " x-relay-error " : " true "
379
- ]
380
- )
381
- . snapshotRequest {
382
- #"""
383
- curl \
384
- --request POST \
385
- --header "X-Client-Info: functions-swift/0.0.0" \
386
- --header "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" \
387
- "http://localhost:5432/functions/v1/stream"
388
- """#
389
- }
390
- . register ( )
391
-
392
- let stream = sut. _invokeWithStreamedResponse ( " stream " )
393
-
394
- do {
395
- for try await _ in stream {
396
- XCTFail ( " should throw error " )
397
- }
398
- } catch FunctionsError . relayError {
399
- }
400
- }
401
319
}
0 commit comments