Add tests for getSessionId helper

This commit is contained in:
Dan Sosedoff
2016-02-26 08:48:55 -08:00
parent 86f63eecc5
commit c57b477dc9
4 changed files with 21 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ package api
import (
"fmt"
"mime"
"net/http"
"path/filepath"
"strconv"
"strings"
@@ -70,10 +71,10 @@ func desanitize64(query string) string {
return query
}
func getSessionId(c *gin.Context) string {
id := c.Request.Header.Get("x-session-id")
func getSessionId(req *http.Request) string {
id := req.Header.Get("x-session-id")
if id == "" {
id = c.Request.URL.Query().Get("_session_id")
id = req.URL.Query().Get("_session_id")
}
return id
}