From 6f48b58b18b21957cdca7c0603962673afc6841a Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <takowl@gmail.com>
Date: Tue, 11 Nov 2014 14:46:53 -0800
Subject: [PATCH] Fix various review comments

---
 IPython/html/services/contents/filemanager.py        |  2 +-
 .../services/contents/tests/test_contents_api.py     | 12 +++++-------
 IPython/html/static/services/contents.js             |  8 ++++----
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/IPython/html/services/contents/filemanager.py b/IPython/html/services/contents/filemanager.py
index 67af55c66..f718d0863 100644
--- a/IPython/html/services/contents/filemanager.py
+++ b/IPython/html/services/contents/filemanager.py
@@ -277,7 +277,7 @@ class FileContentsManager(ContentsManager):
             Whether to include the contents in the reply
         type_ : str, optional
             The requested type - 'file', 'notebook', or 'directory'.
-            Will raise HTTPError 406 if the content doesn't match.
+            Will raise HTTPError 400 if the content doesn't match.
         format : str, optional
             The requested format for file contents. 'text' or 'base64'.
             Ignored if this returns a notebook or directory model.
diff --git a/IPython/html/services/contents/tests/test_contents_api.py b/IPython/html/services/contents/tests/test_contents_api.py
index 5c5b3b937..e49e0bf8d 100644
--- a/IPython/html/services/contents/tests/test_contents_api.py
+++ b/IPython/html/services/contents/tests/test_contents_api.py
@@ -35,7 +35,7 @@ class API(object):
     def __init__(self, base_url):
         self.base_url = base_url
 
-    def _req(self, verb, path, body=None):
+    def _req(self, verb, path, body=None, params=None):
         response = requests.request(verb,
                 url_path_join(self.base_url, 'api/contents', path),
                 data=body,
@@ -47,14 +47,12 @@ class API(object):
         return self._req('GET', path)
 
     def read(self, path, type_=None, format=None):
-        query = []
+        params = {}
         if type_ is not None:
-            query.append('type=' + type_)
+            params['type'] = type_
         if format is not None:
-            query.append('format=' + format)
-        if query:
-            path += '?' + '&'.join(query)
-        return self._req('GET', path)
+            params['format'] = format
+        return self._req('GET', path, params=params)
 
     def create_untitled(self, path='/', ext='.ipynb'):
         body = None
diff --git a/IPython/html/static/services/contents.js b/IPython/html/static/services/contents.js
index 0d4d7cbce..6c7922dd3 100644
--- a/IPython/html/static/services/contents.js
+++ b/IPython/html/static/services/contents.js
@@ -87,10 +87,10 @@ define([
             error : this.create_basic_error_handler(options.error)
         };
         var url = this.api_url(path);
-        if (options.type) {
-            url += '?type=' + options.type;
-        }
-        $.ajax(url, settings);
+        params = {};
+        if (options.type) { params.type = options.type; }
+        if (options.format) { params.format = options.format; }
+        $.ajax(url + '?' + $.param(params), settings);
     };