package com.yutou.okhttp;

import okhttp3.Request;

import java.util.HashMap;

public class ParamsContext {
    private IRequestParam iRequestParam;
    private Request request;
    private HashMap<String,String> map;

    public ParamsContext(HashMap<String,String> map,Request request) {
        if(map==null){
            map=new HashMap<>();
        }
        this.map=map;
        this.request = request;
    }

    public Request getInRequest() {
        switch (request.method()) {
            case "GET":
                iRequestParam = new GetRequestParams();
                break;
            case "POST":
                iRequestParam = new PostRequestParams();
                break;
        }
        return iRequestParam.getRequest(map,request);
    }
}