ofetch icon indicating copy to clipboard operation
ofetch copied to clipboard

fix: compatible with qq browser on ios, close #294

Open markthree opened this issue 1 year ago โ€ข 13 comments

๐Ÿ”— Linked issue

#294

nuxt/nuxt/issues/25956

nuxt/nuxt/issues/24229

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • [x] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality like performance)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

This doesn't look perfect, but after manual testing, everything runs smoothly and there are no break change.

The reason may be that the core used by these browsers has not yet implemented response.body ๐Ÿคฃ

๐Ÿ“ Checklist

  • [x] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

markthree avatar Feb 27 '24 08:02 markthree

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 59.30%. Comparing base (244fb6a) to head (6da36df). Report is 54 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #366      +/-   ##
==========================================
+ Coverage   56.86%   59.30%   +2.43%     
==========================================
  Files          16       16              
  Lines         728      747      +19     
  Branches      113      162      +49     
==========================================
+ Hits          414      443      +29     
+ Misses        303      293      -10     
  Partials       11       11              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 03 '24 21:03 codecov[bot]

Thanks for the PR. I would love to have further investigation before merging this (otherwise ofetch ends up with lots of old browser compatibility fixes)

Do you mind to make a minimal testing environment (html+js) and share the browser version/platform required to verify.

pi0 avatar Mar 04 '24 10:03 pi0

Dear @pi0๏ผŒI apologize, but I am unable to provide a reproducible test case.

On one hand, it only occurs in the QQ Browser on iOS, and I am not very clear about the WebKit version being used (my phone is running iOS 17).ย 

Also, I am not very familiar with testing on old browsers, so I apologize for not being able to provide a shareable test environment. ๐Ÿ˜ญ

markthree avatar Mar 04 '24 13:03 markthree

Okay, no worries. I will try to assemble a reproduction env once could but it is essential before we can move it forward I hope it is reasonable.

pi0 avatar Mar 04 '24 15:03 pi0

Okay, no worries. I will try to assemble a reproduction env once could but it is essential before we can move it forward I hope it is reasonable.

Thank you ๐Ÿฅฐ

markthree avatar Mar 05 '24 02:03 markthree

So has this problem been resolved? I've been waiting for the new version ๐Ÿ™‚

zhangjunjie6b avatar Mar 25 '24 06:03 zhangjunjie6b

If someone doesn't have high stability requirements, they can use this module โ†’ markthree/nuxt-fix-ofetch

markthree avatar Apr 06 '24 07:04 markthree

Seems to be fixed in the latest QQ browser @markthree can you confirm?

https://github.com/unjs/ofetch/issues/294#issuecomment-2167757063

pi0 avatar Jun 17 '24 09:06 pi0

Seems to be fixed in the latest QQ browser @markthree can you confirm?

#294 (comment)

Yes, the problem still exists, it's a problem with ofetch, and it can be reproduced when using it solely

markthree avatar Jun 17 '24 10:06 markthree

From @xjccc comment:

now.. QQ version: 15.1.6.5925 UC version: 16.5.5.2341 works fine

But you have issue with these versions and ofetch?

pi0 avatar Jun 17 '24 10:06 pi0

From @xjccc comment:

now.. QQ version: 15.1.6.5925 UC version: 16.5.5.2341 works fine

But you have issue with these versions and ofetch?

yes, QQ Browser version: 15.1.7

markthree avatar Jun 17 '24 10:06 markthree

Thanks to the onResponse option, I'm now using it to hack in my production environment, and so far I've found no problems! ๐Ÿคฃ

ref โ†’ nuxt-fix-ofetch/src/runtime/00.fetch.client.ts#L52-#L86

markthree avatar Jun 17 '24 10:06 markthree

I upgrade my QQ Browser version: 15.1.7.5928

iOS version: 17.5.1


  • Operating System: Darwin
  • Node Version: v20.10.0
  • Nuxt Version: 3.12.2
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.6
  • Package Manager: [email protected]

my web site works fine..

xjccc avatar Jun 17 '24 11:06 xjccc

Hi dear @markthree Again sorry this took long.

We have merged a relative fix in https://github.com/unjs/ofetch/pull/398 that passes _bodyInit directly as _data.

I think we might add an improvement to check if body is blob, use .stream()

pi0 avatar Oct 08 '24 15:10 pi0