From 6eb1c3d63827bc5ab3cf641d743129b155b3ef02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Garc=C3=ADa?=
 <dani-garcia@users.noreply.github.com>
Date: Tue, 6 Nov 2018 16:53:34 +0100
Subject: [PATCH] Fixed change in organizations header, now
 Request::get_param() are indexed by segment, not dynamic parameter.

---
 src/auth.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/auth.rs b/src/auth.rs
index cc28b3ba..0bc95ee5 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -195,8 +195,8 @@ impl<'a, 'r> FromRequest<'a, 'r> for OrgHeaders {
             Outcome::Forward(f) => Outcome::Forward(f),
             Outcome::Failure(f) => Outcome::Failure(f),
             Outcome::Success(headers) => {
-                // org_id is expected to be the first dynamic param
-                match request.get_param::<String>(0) {
+                // org_id is expected to be the second param ("/organizations/<org_id>")
+                match request.get_param::<String>(1) {
                     Some(Ok(org_id)) => {
                         let conn = match request.guard::<DbConn>() {
                             Outcome::Success(conn) => conn,