Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
RSpec extension for HTTP request
require 'httpspec_simple'
base_url 'http://kozy4324.github.io'
describe request('/') do
it { should be_http_ok }
it { should respond_within(2).seconds }
it { should retrieve_body_including '<title>L4L</title>' }
end
describe request('/blog/archives/') do
it { should be_http_ok }
it { should respond_within(2).seconds }
it { should retrieve_body_including '<title>Blog Archive - L4L</title>' }
end
$ rspec -f d
http://kozy4324.github.io/
should be http ok
should respond within 2 seconds (got 0.122 seconds)
should retrieve body including "<title>L4L</title>"
http://kozy4324.github.io/blog/archives/
should be http ok
should respond within 2 seconds (got 0.111 seconds)
should retrieve body including "<title>Blog Archive - L4L</title>"
Example passes if response is 200 ok
Example passes if response is 301 or 302
Example passes if response is 301 and Location
response header has a value which equals expected url
Example passes if response is 302 and Location
response header has a value which equals expected url
Example passes if response is 404
Example passes if response is 503
Example passes if response time is less than n seconds
Example passes if response body include the passed string
Example passes if response body match the passed regexp
Do request
option key | type | description |
---|---|---|
:retry | Integer | when the response code is {40x,50x} or the timeout occurs, retry request the specific times, default value is 0 |
:timeout | Integer | set to Net::HTTP's open_timeout and read_timeout |
:headers | Hash | set to the request header |
:basic_auth | Array | basic auth user and password(ex. ['user', 'passwd'] ) |
Prepend to the url string passed to following request
method
configure the global setting as request()
's opt argument
HttpspecSimple::Request.configure {|config|
config.retry = 3
config.timeout = 15
config.headers = {"user-agent" => "my-agent"}
config.basic_auth = ['user', 'passwd']
}
clear all configuration set by HttpspecSimple::Request.configure
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that httpspec_simple demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.