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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: capacitor native http interceptor breaking requests #7352

Closed
1 of 3 tasks
jongbonga opened this issue Mar 18, 2024 · 5 comments 路 Fixed by #7354
Closed
1 of 3 tasks

[Bug]: capacitor native http interceptor breaking requests #7352

jongbonga opened this issue Mar 18, 2024 · 5 comments 路 Fixed by #7354
Labels

Comments

@jongbonga
Copy link

jongbonga commented Mar 18, 2024

Capacitor Version

馃拪   Capacitor Doctor  馃拪 

Latest Dependencies:

  @capacitor/cli: 5.7.3
  @capacitor/core: 5.7.3
  @capacitor/android: 5.7.3
  @capacitor/ios: 5.7.3

Installed Dependencies:

  @capacitor/cli: 5.7.3
  @capacitor/core: 5.7.3
  @capacitor/android: 5.7.3
  @capacitor/ios: 5.7.3

[success] iOS looking great! 馃憣
[success] Android looking great! 馃憣

Other API Details

npm 10.2.3
node v18.19.0
pod 1.14.3

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

Since 5.7.1 the http requests are either missing params or adding extra elements to the URL.
The current behaviour is adding localhost/_capacitor_https_interceptor_ to the url on IOS when CapacitorHttp is enabled

using mapbox sdk
Screenshot 2024-03-18 at 15 44 27

using axios
Screenshot 2024-03-18 at 16 27 54

Expected Behavior

Foreign elements shouldn't break the request

Project Reproduction

https://github.com/jongbonga/code-reproduction

Additional Information

No response

@colbymelvin
Copy link

I'm noticing the same on iOS / Capacitor 5.7.3.

Notably, the URLs are formatted the same on Android and aren't causing issues, so I have to assume this is an issue with how the native iOS webView code handles these intercepted requests.

@jcesarmobile jcesarmobile added the type: bug A confirmed bug report label Mar 18, 2024
Copy link

ionitron-bot bot commented Mar 18, 2024

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

@jcesarmobile
Copy link
Member

jcesarmobile commented Mar 18, 2024

the problem is iOS >= 17.2 not allowing to change the protocol from http:/https: to capacitor: so they can't be intercepted

@st474ddr
Copy link

st474ddr commented Mar 24, 2024

@jcesarmobile (Solved)
Maybe I still encounter the same problem.

I want to send a request to Microsoft Graph API.
You could see my request URL is capacitor://oacloud360/_capacitor_https_interceptor_/graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2024-03-24T00:00:00%2B08:00&endDateTime=2024-03-24T23:59:59%2B08:00&$top=50

However, the response showed it got the parameter "startDateTime" was 2024-03-24T00:00:00 08:00.
The "+" or "%2B" has gone.

This problem only occurs on iOS, and my iOS version is 17.4

馃拪   Capacitor Doctor  馃拪 

Latest Dependencies:

  @capacitor/cli: 5.7.4
  @capacitor/core: 5.7.4
  @capacitor/android: 5.7.4
  @capacitor/ios: 5.7.4

Installed Dependencies:

  @capacitor/cli: 5.7.4
  @capacitor/ios: 5.7.4
  @capacitor/core: 5.7.4
  @capacitor/android: 5.7.4

[success] iOS looking great! 馃憣
[success] Android looking great! 馃憣

316316333-d5489298-1f43-4e94-9716-ca9bd0233419

--- I have Solved the problem--- (back to commit before 514409a)
I change the code at 'WebViewAssetHandler.swift' (line 154)
Original code urlRequest.url = URL(string: targetUrl.removingPercentEncoding ?? targetUrl)
Changed code urlRequest.url = URL(string: targetUrl)

Copy link

ionitron-bot bot commented Apr 26, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants