Welcome to the Linux Foundation Forum!

lab 6.1 (Error : must respond with correct data)

Options

I am trying to run node validate command for lab 6.1 Manipulating Data with RESTful Services (LFW212) but keep getting following error :

$ node validate
☑️ GET http://localhost:34667/boat/1 responded with 200 response
☑️ GET http://localhost:34667/boat/1 responded with correct Content-Type header
☑️ GET http://localhost:34667/boat/1 responded with correct data
☑️ POST http://localhost:34667/boat responded with a 201 response
☑️ POST http://localhost:34667/boat responded with correct Content-Type header
☑️ POST http://localhost:34667/boat responded with correct data
☑️ GET http://localhost:34667/boat/3 responded with 200 response
☑️ GET http://localhost:34667/boat/3 responded with correct Content-Type header
⛔️ GET http://localhost:34667/boat/3 must respond with correct data
got - {"data":{"brand":"test","color":"test"}})

My server is written using express framework and node -v is v16.20.2

I figure that something is with the line 135 of validate.js in labs/ch-6/labs-1

assert.deepEqual(result, expect, GET ${url} must respond with correct data\n got - ${content}))

but can't get that working. Would appreciate some help debugging the issue.
Thank you.

Answers

  • sms92
    Options

    In validate.js file I have updated the above line with

    assert.deepEqual(result.brand?result:result.data, expect, GET ${url} must respond with correct data\n got - ${content}))

    and this change let the code passes the "⛔️ GET http://localhost:34667/boat/3 must respond with correct data" check but now I am stuck with following check

    ⛔️ POST http://localhost:35295/boat with poison data to generate unknown error must respond with 500 response

    Any guidance is hugely appreciated and specially in terms of exam perspective; candidates aren't expected to change validate.js file. So, me changing the validate.js doesn't make any sense. Am I even in the right direction to resolve it?

  • xdxmxc
    xdxmxc Posts: 139
    Options

    @sms92 I'd need to see your service code

Categories

Upcoming Training