grim/resticide

Finish implementing the loading of responses
develop
2016-07-09, Gary Kramlich
9fc35be92097
Parents aa02a92eda29
Children 6b41b6067294
Finish implementing the loading of responses
--- a/loader/json.go Sat Jul 09 12:25:35 2016 -0500
+++ b/loader/json.go Sat Jul 09 12:58:01 2016 -0500
@@ -51,6 +51,16 @@
return headers
}
+func parseFile(file map[string]interface{}) map[string]string {
+ tf := map[string]string{}
+
+ for k, v := range file {
+ tf[k] = v.(string)
+ }
+
+ return tf
+}
+
func parseResponse(r interface{}) test.Response {
resp := r.(map[string]interface{})
@@ -66,6 +76,14 @@
tr.Body = body.(string)
}
+ if jsonSchmea, found := resp["json-schema"]; found {
+ tr.JSONSchema = jsonSchmea.(map[string]interface{})
+ }
+
+ if file, found := resp["file"]; found {
+ tr.File = parseFile(file.(map[string]interface{}))
+ }
+
return tr
}