Skip to content

Conversation

@elvessilvavieira
Copy link

@elvessilvavieira elvessilvavieira commented Nov 23, 2025

Hi, @AugustinMauroy

Here's a draft. I'd like to know if I'm on the right track. There are some things missing, like the README, but I'll add them. Thx

issue: #128

@AugustinMauroy
Copy link
Member

No need to ping me, I receive notification for all thing on the repo

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too bad there are some pont that you can improve 👍

@@ -0,0 +1,22 @@
schema_version: "1.0"
name: "@nodejs/outgoingmessage-headers"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "@nodejs/outgoingmessage-headers"
name: "@nodejs/http-outgoingmessage-headers"

not fan of the name but my proposition did look right @nodejs/userland-migrations any idea ?

export default function transform(root: SgRoot<Js>): string | null {
const rootNode = root.root();
const edits: Edit[] = [];
let hasChanges = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let hasChanges = false;

Comment on lines +88 to +89
if (!hasChanges) return null;
return rootNode.commitEdits(edits);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!hasChanges) return null;
return rootNode.commitEdits(edits);
if (!edits.lenght) return null;
return rootNode.commitEdits(edits);

the hasChanges logic isn't needed.

const matches = rootNode.findAll({
rule: { pattern: "$OBJ._headers[$KEY]" },
});
for (const m of matches) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (const m of matches) {
for (const m of matches) {


{
const matches = rootNode.findAll({
rule: { pattern: "$OBJ._headers[$KEY]" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main part here...

Here if the user code have ah propriety expression _headers it's will be catch. We need a more complex logic to catch http usage and -> catch response objects -> catch _headers

I have to admit that the orignal issue examples wasn't 100% complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants