-
Notifications
You must be signed in to change notification settings - Fork 10
fix(network-activity-plugin): rewrite cookie parser to match RN specific logic #61
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
36d9da3
fix(network-activity-plugin): rewrite cookie parser to match RN speci…
NepeinAV ea7a4f4
feat(network-activity-plugin): show multiple rows of header when it i…
NepeinAV 6006587
chore: add version plan
NepeinAV 95a8d90
refactor(network-activity-plugin): remove childClassName from Section
NepeinAV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rozenite/network-activity-plugin': prerelease | ||
--- | ||
|
||
Rewrites the cookie parser to properly handle React Native specific header logic and adds support for displaying multiple header values when they are arrays. The cookie parser now correctly parses Set-Cookie headers according to React Native's networking behavior, while the Headers tab can now display multiple values for headers that contain array data, improving the debugging experience for network requests with complex header structures. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/network-activity-plugin/src/ui/components/CookieCard.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Badge } from './Badge'; | ||
import { Cookie } from '../../shared/client'; | ||
import { cn } from '../utils/cn'; | ||
|
||
type CookieCardProps = { | ||
cookie: Cookie; | ||
keyClassName?: string; | ||
}; | ||
|
||
export const CookieCard = ({ cookie, keyClassName }: CookieCardProps) => ( | ||
<div className="bg-gray-800 border border-gray-700 rounded p-3"> | ||
<div className="flex items-center justify-between mb-2"> | ||
<span className={cn('text-sm font-medium', keyClassName)}> | ||
{cookie.name} | ||
</span> | ||
<div className="flex items-center gap-2"> | ||
{cookie.secure && ( | ||
<Badge | ||
variant="outline" | ||
className="text-xs text-yellow-400 border-yellow-400" | ||
> | ||
Secure | ||
</Badge> | ||
)} | ||
{cookie.httpOnly && ( | ||
<Badge | ||
variant="outline" | ||
className="text-xs text-purple-400 border-purple-400" | ||
> | ||
HttpOnly | ||
</Badge> | ||
)} | ||
</div> | ||
</div> | ||
<div className="text-sm text-gray-300 mb-2 break-all">{cookie.value}</div> | ||
<div className="grid grid-cols-2 gap-4 text-xs text-gray-400"> | ||
{cookie.domain && ( | ||
<div> | ||
<span className="font-medium">Domain:</span> {cookie.domain} | ||
</div> | ||
)} | ||
{cookie.path && ( | ||
<div> | ||
<span className="font-medium">Path:</span> {cookie.path} | ||
</div> | ||
)} | ||
{cookie.expires && ( | ||
<div> | ||
<span className="font-medium">Expires:</span> {cookie.expires} | ||
</div> | ||
)} | ||
{cookie.maxAge && ( | ||
<div> | ||
<span className="font-medium">Max-Age:</span> {cookie.maxAge} | ||
</div> | ||
)} | ||
{cookie.sameSite && ( | ||
<div> | ||
<span className="font-medium">SameSite:</span> {cookie.sameSite} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are crossing the device <-> DevTools UI boundary. This is potentially dangerous and can result in unwanted modules to be included in the bundle. I suggest moving it to the 'shared' directory.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you just want to move this file to a shared directory? Right now it is only used on RN side (and always will be), so maybe not
shared
, butreact-native
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My fault. Noticed relative paths in both sub-directories and assumed the source is in 'ui' 🙈