Comments (10)
Try using inspectRequest()
to ensure that the header values are getting passed correctly, and are the values that you expect.
from frisby.
Thanks.
It worked adding above globaSetup().
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
from frisby.
Thanks @vlucas.
If you have read my comment. My test is getting passed even when expect checks for status 200 and provided is 400. And my token is not getting generated in either case.
I tried inspectBody(),inspectJson() also inspectrequest(). None worked.
If you can tell is there anything else I need to change in my code.
I am following this link:
https://docs.frisbyjs.com/api-and-usage/setup
from frisby.
Your curl command disables HTTPS cert checking with the -k
flag.
So maybe you need to do the same in the frisby test.
Just guessing but maybe you should add the node-fetch
options to disable HTTPS cert checking.
Try this.
var frisby = require('frisby');
frisby.globalSetup({
request: {
headers: {
'Authorization': 'Basic ' + Buffer.from("username:password").toString('base64'),
'header':'value'
},
// It's one of these
strictSSL : false,
rejectUnauthorized: false
}
});
//do setup for Authorization of the token for REST call
it ('uses globalSetup for every test after it is called', function () {
return frisby.get('URL')
.inspectResponse()
.expect('status', 400);
});
from frisby.
@LarryBattleWork
Getting error when passing either of strictSSL : false, rejectUnauthorized: false in globalSetup()
Failures:
FetchError: request to http://URL/login failed, reason: socket hang up
Stack:
error properties: null({ type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET', constructor: Function })
at
at ClientRequest. (dir\node_modules\node-fetch\lib\index.js:1455:11)
at ClientRequest.emit (events.js:310:20)
from frisby.
So your solution looks like this?
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
frisby.globalSetup({
request: {
headers: {
'Authorization': 'Basic ' + Buffer.from("username:password").toString('base64'),
'header':'value'
}
}
});
NOTE: Don't use NODE_TLS_REJECT_UNAUTHORIZED
in production code.
Doc link: https://nodejs.org/api/cli.html#cli_node_tls_reject_unauthorized_value
from frisby.
@LarryBattleWork thanks for response.
Can you suggest other property other than this which will work.
I tried
strictSSL : false,
rejectUnauthorized: false
Both seems to not work.
Also how can I get the response in variable.
I tried
.then(function (res) {
let postId = res.json;
Console.log(postId)
}
But this seems to give error.
Any suggestions.
from frisby.
If curl -k
option is removed, does it give an error like frisby ?
from frisby.
@H1Gdev
-k in curl is for verifying server legitimacy.
so in that case it error me with ssl error.
from frisby.
@vlucas Can you please suggest which reporting goes with Jasmine-Frisby project.
Or if any links yo can refer me too.
Thanks in advance.
from frisby.
Related Issues (20)
- Iterate through multiple get calls. HOT 3
- could not run test sequentially HOT 21
- frsiby method call returns _fetch: Promise { <pending> }
- could not run test
- unexpected response when posting request with content type x-www-form-urlencoded HOT 9
- Does not show the line where code is failing. Its always points the frisby code.
- Upgrade Joi dependency to v17 HOT 1
- Missing logo HOT 3
- What's the appropriate way to trigger CI/CD? Using a web server? HOT 1
- Is there a function similar to bodyContains but for headers? HOT 2
- Loop through JSON object in Expect()? HOT 12
- Using query parameters in API calls HOT 1
- PUT Call Double Encoding URL HOT 3
- Remove Joi export and move it from peer dependencies to dependencies
- Latest joi version does not work HOT 3
- Unhandled promise rejection: TypeError: response.textConverted is not a function while using Jasmine with Frisby HOT 1
- Update npm package.
- Socket hang up / ECONNRESET errors with Node.js 20.x HOT 4
- CVE on frisby dependency (joi)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frisby.