Search in sources :

Example 16 with RequestNameValue

use of com.dtflys.forest.utils.RequestNameValue in project forest by dromara.

the class ForestRequest method getHeaderNameValueList.

public List<RequestNameValue> getHeaderNameValueList() {
    List<RequestNameValue> nameValueList = new ArrayList<RequestNameValue>();
    for (Iterator<ForestHeader> iterator = headers.headerIterator(); iterator.hasNext(); ) {
        ForestHeader header = iterator.next();
        RequestNameValue nameValue = new RequestNameValue(header.getName(), header.getValue(), TARGET_HEADER);
        nameValueList.add(nameValue);
    }
    return nameValueList;
}
Also used : RequestNameValue(com.dtflys.forest.utils.RequestNameValue)

Example 17 with RequestNameValue

use of com.dtflys.forest.utils.RequestNameValue in project forest by dromara.

the class ByteArrayRequestBody method getNameValueList.

@Override
public List<RequestNameValue> getNameValueList(ForestConfiguration configuration) {
    String str = new String(byteArray);
    List<RequestNameValue> nameValueList = new LinkedList<>();
    nameValueList.add(new RequestNameValue(str, MappingParameter.TARGET_BODY));
    return nameValueList;
}
Also used : RequestNameValue(com.dtflys.forest.utils.RequestNameValue) LinkedList(java.util.LinkedList)

Example 18 with RequestNameValue

use of com.dtflys.forest.utils.RequestNameValue in project forest by dromara.

the class TestForestConfiguration method testDefaultParameters.

@Test
public void testDefaultParameters() {
    ForestConfiguration configuration = ForestConfiguration.createConfiguration();
    List<RequestNameValue> defaultParameters = new LinkedList<>();
    defaultParameters.add(new RequestNameValue("name", "Peter", TARGET_BODY));
    defaultParameters.add(new RequestNameValue("age", "15", TARGET_BODY));
    configuration.setDefaultParameters(defaultParameters);
    assertEquals(defaultParameters, configuration.getDefaultParameters());
}
Also used : ForestConfiguration(com.dtflys.forest.config.ForestConfiguration) RequestNameValue(com.dtflys.forest.utils.RequestNameValue) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

RequestNameValue (com.dtflys.forest.utils.RequestNameValue)18 LinkedList (java.util.LinkedList)7 ForestJsonConverter (com.dtflys.forest.converter.json.ForestJsonConverter)6 Map (java.util.Map)3 ForestConfiguration (com.dtflys.forest.config.ForestConfiguration)2 ForestRuntimeException (com.dtflys.forest.exceptions.ForestRuntimeException)2 ForestQueryMap (com.dtflys.forest.http.ForestQueryMap)2 ForestRequestBody (com.dtflys.forest.http.ForestRequestBody)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 Test (org.junit.Test)2 AddressSource (com.dtflys.forest.callback.AddressSource)1 OnError (com.dtflys.forest.callback.OnError)1 OnLoadCookie (com.dtflys.forest.callback.OnLoadCookie)1 OnProgress (com.dtflys.forest.callback.OnProgress)1 OnRedirection (com.dtflys.forest.callback.OnRedirection)1 OnSaveCookie (com.dtflys.forest.callback.OnSaveCookie)1 OnSuccess (com.dtflys.forest.callback.OnSuccess)1 VariableScope (com.dtflys.forest.config.VariableScope)1 ForestAddress (com.dtflys.forest.http.ForestAddress)1