Tarek Ziadé avatar Tarek Ziadé committed 3b50575

fixes

Comments (0)

Files changed (1)

     """Look for an authorized key.
     """
     key = request.headers.get('X-Short')
-    if key is None or not key in request.config.settings['keys']:
+    if key is None or not key in request.registry.settings['keys']:
         raise exc.HTTPUnauthorized()
 
 
-@short.put(validator=auth)
+@short.post(validator=auth)
 def new_url(request):
     """Adds a shortened URL."""
     url = request.body
-    short = request.registry['storage'].add_short(url)
+    if url == '':
+        raise exc.HTTPBadRequest()
+
+    short = get_storage(request).add_short(url)
     return {'short': short}
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.