Skip to content

javascript: a '/…' string inside one chained route link's arguments becomes the next link's path, shifting every later link's verb and line #1731

Closed

Description

@swapnilpaliwal-sd

Symptom: in a chained registration, a '/…' string written inside one link's arguments (a redirect in an inline handler, a middleware option) is read as the NEXT link's path. From there each later link carries the previous link's verb, path and line.

Repro (Express):

router.get('/', (req, res) => res.redirect('/posts'))   // 9
  .get('/posts', listPosts)                              // 10
  .post('/posts', createPost)                            // 11
  .patch('/posts/:id', editPost);                        // 12

impact createPost → registered as a GET route "/posts" at :10. impact editPost → POST route "/posts" at :11. path '*' createPost → calls it at :10.

Second instance: .post('/orders', validate({ onFail: '/orders/new' }), createOrder) followed by .delete('/orders/:id', removeOrder) → impact removeOrder says POST route "/orders" at the POST line.

Expected: POST "/posts" :11, PATCH "/posts/:id" :12, DELETE "/orders/:id". A link's path is the first argument of its own call.

Activity

  1. added
    bugSomething isn't working
    skillAgent-facing query skill (skills/axiomcode)
    on Sep 29, 2026
  2. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Already fixed on the latest 0.1.8 by #1747: a route link now reads its path from its own argument list in the source, so a '/…' string inside a handler or a middleware option is no longer taken as the next link's path.

    Repro (both instances from this issue, in one Express router file):

    router.get('/', (req, res) => res.redirect('/posts'))   // 13
      .get('/posts', listPosts)                              // 14
      .post('/posts', createPost)                            // 15
      .patch('/posts/:id', editPost);                        // 16
    router.post('/orders', validate({ onFail: '/orders/new' }), createOrder)  // 17
      .delete('/orders/:id', removeOrder);                   // 18

    Latest 0.1.8:

    $ axiomcode impact createPost --kind method   → registered as a POST route "/posts"      src/routes.js:15
    $ axiomcode impact editPost --kind method     → registered as a PATCH route "/posts/:id" src/routes.js:16
    $ axiomcode impact removeOrder --kind method  → registered as a DELETE route "/orders/:id" src/routes.js:18
    $ axiomcode path '*' createPost               → calls it at :15
    

    The same 7 checks (these plus the controls listPosts :14, createOrder :17, listTags :19) all pass on 0.1.8. With ax_registration.py from before #1747, 5 of the 7 fail.

  3. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    This issue now tracks 2 related issues about JavaScript route chains and HTTP client request shapes (#1732, #1758). Those issues are closed as duplicates of this one; each keeps its own description and reproduction. The group is fixed together in one change, and this issue closes when that change reaches the release branch.

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

Metadata

Metadata

Labels

bugSomething isn't workingjavascriptJavaScriptskillAgent-facing query skill (skills/axiomcode)

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions