putsreq 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/app/views/home/index.html.erb +7 -13
- data/bin/putsreq +3 -1
- data/lib/putsreq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d06503d7f311af6ea6889c942724186869f9f40
|
4
|
+
data.tar.gz: 35f4b09443af29f865ab6b27492aa3f98d6a5b07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c23e0ad1396408aa4353a32b402a1dabd145e2069354a51fc91742aef9f9257f4fb79042f6a57e274136fbfdea64776f2cc68acce25c7f8a8955451437b4f7
|
7
|
+
data.tar.gz: 43c51f6fc3337fa44e126c265564d9af1d208489aeb6cbe83ad2b7ce937ee27158d36bc45d7917abc2136f3277ae33747d07a570863999df261e7f50eefbc0ea
|
data/README.md
CHANGED
@@ -111,6 +111,20 @@ request.body = parsedBody;
|
|
111
111
|
request.forwardTo = 'http://example.com/api';
|
112
112
|
```
|
113
113
|
|
114
|
+
### CLI
|
115
|
+
|
116
|
+
Want to test a Webhook calls against your localhost? PutsReq makes it easy!
|
117
|
+
|
118
|
+
```shell
|
119
|
+
gem install putsreq
|
120
|
+
|
121
|
+
putsreq forward --to http://localhost:3000 --token YOUR-TOKEN
|
122
|
+
Listening requests from YOUR-TOKEN
|
123
|
+
Forwarding to http://localhost:3000
|
124
|
+
Press CTRL+c to terminate
|
125
|
+
2016-12-21 20:49:54 -0200 POST 200
|
126
|
+
```
|
127
|
+
|
114
128
|
### Ajax
|
115
129
|
|
116
130
|
PutsReq supports [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), so you can use it to test your Ajax calls.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<div class="">
|
4
4
|
<header>
|
5
5
|
<%= image_tag 'logo.png' %>
|
6
|
-
<h3><em>PutsReq</em> lets you record HTTP requests and
|
6
|
+
<h3><em>PutsReq</em> lets you record HTTP requests and fake responses like no other tool available. Try it now!</h3>
|
7
7
|
<%= form_for :bucket, url: buckets_path do |f| %>
|
8
8
|
<button class="btn btn-primary btn-large">Create a PutsReq</button>
|
9
9
|
<em>
|
@@ -27,18 +27,12 @@
|
|
27
27
|
</ul>
|
28
28
|
</div>
|
29
29
|
<% end %>
|
30
|
-
<h4>Record
|
31
|
-
<p>Change your target URL to a PutsReq URL
|
32
|
-
|
33
|
-
<
|
34
|
-
<
|
35
|
-
|
36
|
-
<p>Some use cases:</p>
|
37
|
-
<ul>
|
38
|
-
<li>Get the real response once then create a Response Builder simulating it and use PutsReq for the next calls.</li>
|
39
|
-
<li>Use PutsReq for your integration tests to verify if your application is making the HTTP requests as expected <a href="https://github.com/phstc/putsreq_integration_sample/blob/master/spec/acceptance/create_user_spec.rb">by checking the last recorded request</a>.</li>
|
40
|
-
<li>To benchmark by checking the First and Last request timestamps, or by checking the numbers of requests made within a period.</li>
|
41
|
-
</ul>
|
30
|
+
<h4>Record requests</h4>
|
31
|
+
<p>Change your target URL to a PutsReq URL to start recording your requests.</p>
|
32
|
+
<h4 class="tm20">Fake responses</h4>
|
33
|
+
<p>PutsReq is the easiest way to fake HTTP responses. You can define the response status, headers and body you want using <a href="https://github.com/phstc/putsreq#response-builder">JavaScript</a>.
|
34
|
+
<h4 class="tm20">Forward requests</h4>
|
35
|
+
<p>You can easily <a href="https://github.com/phstc/putsreq#forwardto">forward requests to another URL</a>, including <a href="https://github.com/phstc/putsreq#CLI">localhost</a>.
|
42
36
|
</section>
|
43
37
|
</div>
|
44
38
|
</div>
|
data/bin/putsreq
CHANGED
@@ -28,10 +28,12 @@ class PutsReqCLI < Thor
|
|
28
28
|
method_option :token, desc: 'PutsReq token', required: true
|
29
29
|
method_option :to, desc: 'destination URL', required: true
|
30
30
|
def forward
|
31
|
+
trap('SIGINT', 'EXIT')
|
32
|
+
|
31
33
|
token = parse_bucket_token(options[:token])
|
32
34
|
to = options[:to]
|
33
35
|
|
34
|
-
puts "
|
36
|
+
puts "Listening requests from #{token}"
|
35
37
|
puts "Forwarding to #{to}"
|
36
38
|
puts "Press CTRL+c to terminate"
|
37
39
|
|
data/lib/putsreq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: putsreq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Cantero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|