Commit c51b990b authored by M. Rehan Abbasi's avatar M. Rehan Abbasi
Browse files

use json decoder for decoding predicted qos request for less latency

parent 7338b249
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
@@ -572,8 +571,8 @@ func updateStoreName(storeName string) {
func predictedQosPost(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	var requestData PredictedQos
	bodyBytes, _ := ioutil.ReadAll(r.Body)
	err := json.Unmarshal(bodyBytes, &requestData)
	decoder := json.NewDecoder(r.Body)
	err := decoder.Decode(&requestData)
	if err != nil {
		log.Error(err.Error())
		errHandlerProblemDetails(w, "The request body is either empty or it's an invalid JSON.", http.StatusBadRequest)