Why ‘Get’ request is returning blank object for particular request?

This is the code in which the problem is occurring:
router.get("/", async(req, res) => {
    const username = req.query.user;
    const catName = req.query.cat;

    try {
        let posts;
        if (username) {
            posts = await Post.find({ username: username });
        } else if (catName) {
            posts = await Post.find({ categories: { $in: [catName], }, });
        } else {
            posts = await Post.find();
        }
        res.status.json(posts);
    } catch (err) {
        res.status(500).json(err)
    }
});
if I am using this its working fine
   router.get("/", async(req, res) => {
         try {
             const post = await Post.find()
    
             res.status(200).json(post)
    
         } catch (err) {
             res.status(500).json(err)
         }
     })
I want to use the first request with queries but that is returning a empty object I can’t find error!

Every other requests are working just fine in this route expect the first one!