#409 Error code conflict

8 messages · Page 1 of 1 (latest)

vivid sedge
#

Hello, I need to test a bunch of function and in here I am getting a conflict.

Is it because there is a get and a patch at the same address (which is /carts)?

#
this.router.patch(
            '/',
            this.authenticator.isLoggedIn,
            this.authenticator.isCustomer,
            (req: any, res: any, next: any) =>
                this.controller
                    .checkoutCart(req.user)
                    .then(() => res.status(200).end())
                    .catch(err => {
                        next(err);
                    }),
        );
#

the get router

this.router.get(
            '/',
            this.authenticator.isLoggedIn,
            this.authenticator.isCustomer,
            (req: any, res: any, next: any) =>
                this.controller
                    .getCart(req.user)
                    .then((cart: Cart) => {
                        res.status(200).json(cart);
                    })
                    .catch(err => {
                        next(err);
                    }),
        );
#

and the test:

#
describe("PATCH /carts", () => {
        test("checking out the current cart, expecting code 200", async () => {
            
            await request(app)
            .patch(routePath+'/carts')
            .set("Cookie", customerCookie)
            .expect(200)
        }) 
    }) 
sage wharf
#

409 looks like an error code returned by some code, so I would look at your middlewares