Skip to content

Commit

Permalink
Allow any URL after bin ID.
Browse files Browse the repository at this point in the history
This lets you post in with binid/path, binid.suffix/path,
binid.suffix or binid.
  • Loading branch information
cmouse committed Sep 13, 2016
1 parent 0e36a0c commit 4ee3fbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions requestbin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def callback(status, headers, exc_info=None):
app.jinja_env.filters['short_date'] = short_date

app.add_url_rule('/', 'views.home')
app.add_url_rule('/<name>', 'views.bin', methods=['GET', 'POST', 'DELETE', 'PUT', 'OPTIONS', 'HEAD', 'PATCH', 'TRACE'])
app.add_url_rule('/<path:name>', 'views.bin', methods=['GET', 'POST', 'DELETE', 'PUT', 'OPTIONS', 'HEAD', 'PATCH', 'TRACE'])

app.add_url_rule('/docs/<name>', 'views.docs')
app.add_url_rule('/api/v1/bins', 'api.bins', methods=['POST'])
Expand All @@ -75,4 +75,4 @@ def callback(status, headers, exc_info=None):

# app.add_url_rule('/robots.txt', redirect_to=url_for('static', filename='robots.txt'))

from requestbin import api, views
from requestbin import api, views
3 changes: 2 additions & 1 deletion requestbin/db.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import feedparser
import time

import re
from requestbin import config

bin_ttl = config.BIN_TTL
Expand All @@ -22,6 +22,7 @@ def create_request(bin, request):
return db.create_request(bin, request)

def lookup_bin(name):
name=re.split(r"[/.]", name)[0]
return db.lookup_bin(name)

def count_bins():
Expand Down

0 comments on commit 4ee3fbb

Please sign in to comment.