Skip to content

crazytonyli/swift-linux-url-session-redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

The server.py script starts a web server with two endpoints:

  1. POST /login - Returns a 302 redirect to /me and sets a logged_in=true cookie
  2. GET /me - Returns "You are logged in" if the logged_in=true cookie is present, otherwise returns "Please log in"

Expected Behavior

All Swift test functions send a POST /login request and expect a "You are logged in" response. This works because URLSession automatically:

  1. Follows the 302 redirect from /login to /me
  2. Includes cookies set by the /login response in the subsequent request to /me

Issue

The tests pass on macOS but fail on Linux. Specifically, the test that uses dataTask(...) with a custom delegate fails on Linux.

Steps to Reproduce

Assuming you are using macOS.

  1. Start the web server: python server.py
  2. Run swift test to verify all tests pass on macOS.
  3. Run swift test on a Docker image to reproduce the issue on Linux:
docker run --rm -v "$PWD:/app" -w /app --network host swift:6.2 swift test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published