Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting cookies from Http requests: Headers.getSetCookie() #47049

Closed
LinusU opened this issue Oct 16, 2024 · 4 comments
Closed

Getting cookies from Http requests: Headers.getSetCookie() #47049

LinusU opened this issue Oct 16, 2024 · 4 comments
Labels
Needs: Author Feedback Needs: Version Info 🌐Networking Related to a networking API. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@LinusU
Copy link
Contributor

LinusU commented Oct 16, 2024

Description

Currently, it's not possible to get the Set-Cookie headers from http requests, specifically via headers.getSetCookie().

I've started work on this:

  1. Implement Set-Cookie handling JakeChampion/fetch#1472
  2. main...LinusU:react-native:get-set-cookie

Plan for next steps:

  1. Make sure changes to Android part works
  2. Also update iOS to send array instead of map
  3. Update JavaScript part to receive array instead of map
  4. Test that this works

If anyone wants to help out, feel free to!

Steps to reproduce

Snack: https://snack.expo.dev/@linusu/authentic-yellow-soda

Relevant code:

const response = await fetch('https://httpbin.org/cookies/set?x=x&y=y')
const cookies = response.headers.getSetCookie()

// cookies should be ["x=x", "y=y"]

React Native Version

0.74.5

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.0.1
  CPU: (11) arm64 Apple M3 Pro
  Memory: 1001.42 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.16.0
    path: ~/Library/Caches/fnm_multishells/42255_1729074242539/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.1
    path: ~/Library/Caches/fnm_multishells/42255_1729074242539/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.21829.142.2421.12409432
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: javac 23
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: 0.74.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

TypeError: response.headers.getSetCookie is not a function (it is undefined)

Reproducer

https://snack.expo.dev/@linusu/authentic-yellow-soda

Screenshots and Videos

No response

@react-native-bot
Copy link
Collaborator

⚠️ Add or Reformat Version Info
ℹ️ We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2

@react-native-bot
Copy link
Collaborator

⚠️ Add or Reformat Version Info
ℹ️ We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.70.2

@react-native-bot
Copy link
Collaborator

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 10, 2024
@react-native-bot
Copy link
Collaborator

This issue was closed because it has been stalled for 7 days with no activity.

@react-native-bot react-native-bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Needs: Version Info 🌐Networking Related to a networking API. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants