Skip to content

Commit

Permalink
fixed the bug with setting headers
Browse files Browse the repository at this point in the history
  • Loading branch information
GulnazSerikbay committed Nov 11, 2023
1 parent 7f61203 commit ac0c61d
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/controllers/write/career.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const Career = module.exports;

Career.register = async (req, res) => {
const userData = req.body;
//console.log(userData);
const URL = `https://career-service-kev265hxta-de.a.run.app/api?data={"Student%20ID":"${userData.student_id}","Gender":"${userData.gender}","Age":${userData.age},"Major":"${encodeURIComponent(userData.major)}","GPA":${encodeURIComponent(userData.gpa)},"Extra%20Curricular":"${encodeURIComponent(userData.extra_curricular)}","Num%20Programming%20Languages":${userData.num_programming_languages},"Num%20Past%20Internships":${userData.num_past_internships}}`

Check failure on line 19 in src/controllers/write/career.js

View workflow job for this annotation

GitHub Actions / Lint (ubuntu-latest, 16)

Missing semicolon
//console.log(URL);

try {
const userCareerData = {
student_id: userData.student_id,
Expand All @@ -38,23 +37,17 @@ Career.register = async (req, res) => {
method: 'GET',
headers: {
'Content-Type': 'application/json'

Check failure on line 39 in src/controllers/write/career.js

View workflow job for this annotation

GitHub Actions / Lint (ubuntu-latest, 16)

Missing trailing comma
}
}

Check failure on line 40 in src/controllers/write/career.js

View workflow job for this annotation

GitHub Actions / Lint (ubuntu-latest, 16)

Trailing spaces not allowed

Check failure on line 40 in src/controllers/write/career.js

View workflow job for this annotation

GitHub Actions / Lint (ubuntu-latest, 16)

Missing trailing comma
});

response = await response.json();

userCareerData.prediction = response.result;
//console.log(userCareerData.prediction);

await user.setCareerData(req.uid, userCareerData);
db.sortedSetAdd("users:career", req.uid, req.uid);
// helpers.formatApiResponse(200, res);

//console.log("blabla")
res.json({});
helpers.formatApiResponse(200, res);
} catch (err) {

Check failure on line 49 in src/controllers/write/career.js

View workflow job for this annotation

GitHub Actions / Lint (ubuntu-latest, 16)

Block must not be padded by blank lines
//console.log("err:"+err);


console.error(response.status);

Check failure on line 51 in src/controllers/write/career.js

View workflow job for this annotation

GitHub Actions / Lint (ubuntu-latest, 16)

'response' is not defined
helpers.noScriptErrors(req, res, err.message, 400);
}
Expand Down

0 comments on commit ac0c61d

Please sign in to comment.