@@ -72,7 +72,7 @@ var _ = Describe("Config", func() {
7272 }
7373}` , mockUserID1 , mockUserID2 , mockUploadID )
7474 conf := & Config {}
75- err := request .DecodeObject (context .Background (), nil , buf , conf )
75+ err := request .DecodeStream (context .Background (), nil , buf , conf )
7676 Expect (err ).ToNot (HaveOccurred ())
7777 Expect (conf .UserID ).To (Equal (mockUserID1 ))
7878 Expect (conf .FollowedUserID ).To (Equal (mockUserID2 ))
@@ -358,7 +358,7 @@ var _ = Describe("Config", func() {
358358 It ("validates threshold units" , func () {
359359 buf := buff (`{"urgentLow": {"threshold": {"units":"%s","value":42}}` , "garbage" )
360360 threshold := & Threshold {}
361- err := request .DecodeObject (context .Background (), nil , buf , threshold )
361+ err := request .DecodeStream (context .Background (), nil , buf , threshold )
362362 Expect (err ).To (MatchError ("json is malformed" ))
363363 })
364364 It ("validates repeat minutes (negative)" , func () {
@@ -376,7 +376,7 @@ var _ = Describe("Config", func() {
376376 }
377377}` , mockUserID1 , mockUserID2 , mockUploadID , glucose .MgdL )
378378 cfg := & Config {}
379- err := request .DecodeObject (context .Background (), nil , buf , cfg )
379+ err := request .DecodeStream (context .Background (), nil , buf , cfg )
380380 Expect (err ).To (MatchError ("value -11m0s is not greater than or equal to 15m0s" ))
381381 })
382382 It ("validates repeat minutes (string)" , func () {
@@ -393,7 +393,7 @@ var _ = Describe("Config", func() {
393393 }
394394}` , mockUserID1 , mockUserID2 , glucose .MgdL )
395395 cfg := & Config {}
396- err := request .DecodeObject (context .Background (), nil , buf , cfg )
396+ err := request .DecodeStream (context .Background (), nil , buf , cfg )
397397 Expect (err ).To (MatchError ("json is malformed" ))
398398 })
399399 })
@@ -414,7 +414,7 @@ var _ = Describe("Config", func() {
414414 }
415415}` , mockUserID1 , mockUserID2 , mockUploadID )
416416 conf := & Config {}
417- err := request .DecodeObject (context .Background (), nil , buf , conf )
417+ err := request .DecodeStream (context .Background (), nil , buf , conf )
418418 Expect (err ).To (Succeed ())
419419 Expect (conf .Low .Repeat ).To (Equal (DurationMinutes (0 )))
420420 })
@@ -458,33 +458,33 @@ var _ = Describe("Threshold", func() {
458458 It ("accepts mg/dL" , func () {
459459 buf := buff (`{"units":"%s","value":42}` , glucose .MgdL )
460460 threshold := & Threshold {}
461- err := request .DecodeObject (context .Background (), nil , buf , threshold )
461+ err := request .DecodeStream (context .Background (), nil , buf , threshold )
462462 Expect (err ).To (BeNil ())
463463 Expect (threshold .Value ).To (Equal (42.0 ))
464464 Expect (threshold .Units ).To (Equal (glucose .MgdL ))
465465 })
466466 It ("accepts mmol/L" , func () {
467467 buf := buff (`{"units":"%s","value":42}` , glucose .MmolL )
468468 threshold := & Threshold {}
469- err := request .DecodeObject (context .Background (), nil , buf , threshold )
469+ err := request .DecodeStream (context .Background (), nil , buf , threshold )
470470 Expect (err ).To (BeNil ())
471471 Expect (threshold .Value ).To (Equal (42.0 ))
472472 Expect (threshold .Units ).To (Equal (glucose .MmolL ))
473473 })
474474 It ("rejects lb/gal" , func () {
475475 buf := buff (`{"units":"%s","value":42}` , "lb/gal" )
476- err := request .DecodeObject (context .Background (), nil , buf , & Threshold {})
476+ err := request .DecodeStream (context .Background (), nil , buf , & Threshold {})
477477 Expect (err ).Should (HaveOccurred ())
478478 })
479479 It ("rejects blank units" , func () {
480480 buf := buff (`{"units":"","value":42}` )
481- err := request .DecodeObject (context .Background (), nil , buf , & Threshold {})
481+ err := request .DecodeStream (context .Background (), nil , buf , & Threshold {})
482482 Expect (err ).Should (HaveOccurred ())
483483 })
484484 It ("is case-sensitive with respect to Units" , func () {
485485 badUnits := strings .ToUpper (glucose .MmolL )
486486 buf := buff (`{"units":"%s","value":42}` , badUnits )
487- err := request .DecodeObject (context .Background (), nil , buf , & Threshold {})
487+ err := request .DecodeStream (context .Background (), nil , buf , & Threshold {})
488488 Expect (err ).Should (HaveOccurred ())
489489 })
490490
0 commit comments