Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en/connector-v2/source/Http.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ They can be downloaded via install-plugin.sh or from the Maven central repositor
| pageing.total_page_size | Int | No | - | This parameter is used to control the total number of pages |
| pageing.batch_size | Int | No | - | The batch size returned per request is used to determine whether to continue when the total number of pages is unknown |
| content_json | String | No | - | This parameter can get some json data.If you only need the data in the 'book' section, configure `content_field = "$.store.book.*"`. |
| format | String | No | json | The format of upstream data, now only support `json` `text`, default `json`. |
| format | String | No | text | The format of upstream data, now only support `json` `text`, default `text`. |
| method | String | No | get | Http request method, only supports GET, POST method. |
| headers | Map | No | - | Http headers. |
| params | Map | No | - | Http params,the program will automatically add http header application/x-www-form-urlencoded. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class HttpConfig {
public static final Option<ResponseFormat> FORMAT =
Options.key("format")
.enumType(ResponseFormat.class)
.defaultValue(ResponseFormat.JSON)
.defaultValue(ResponseFormat.TEXT)
.withDescription("Http response format");
public static final Option<Integer> POLL_INTERVAL_MILLS =
Options.key("poll_interval_millis")
Expand Down Expand Up @@ -113,7 +113,8 @@ public class HttpConfig {
"SeaTunnel enableMultiLines.This parameter can support http splitting response text by line.");

public enum ResponseFormat {
JSON("json");
JSON("json"),
TEXT("text");

private String format;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
import org.apache.seatunnel.api.table.catalog.TableSchema;
import org.apache.seatunnel.api.table.catalog.schema.TableSchemaOptions;
import org.apache.seatunnel.api.table.type.BasicType;
import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
import org.apache.seatunnel.api.table.type.SeaTunnelRow;
import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
import org.apache.seatunnel.common.config.CheckConfigUtil;
import org.apache.seatunnel.common.config.CheckResult;
import org.apache.seatunnel.common.constants.JobMode;
Expand Down Expand Up @@ -156,16 +154,7 @@ protected void buildSchemaWithConfig(Config pluginConfig) {
TableSchema.builder()
.column(
PhysicalColumn.of(
"content",
new SeaTunnelRowType(
new String[] {"content"},
new SeaTunnelDataType<?>[] {
BasicType.STRING_TYPE
}),
0,
false,
null,
null))
"content", BasicType.STRING_TYPE, 0, false, null, null))
.build();

this.catalogTable =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public void testSourceToAssertSink(TestContainer container)
Container.ExecResult execResult17 =
container.executeJob("/http_jsonrequestbody_to_feishu.conf");
Assertions.assertEquals(0, execResult17.getExitCode());

Container.ExecResult execResult18 = container.executeJob("/httpnoschema_to_http.conf");
Assertions.assertEquals(0, execResult18.getExitCode());
}

public String getMockServerConfig() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

env {
execution.parallelism = 1
job.mode = "BATCH"
}

source {
Http {
url = "http://mockserver:1080/example/jsonBody"
method = "POST"
body="{"id":1}"

}
}

sink {
Http {
url = "http://mockserver:1080/example/httpContentSink"
headers {
token = "9e32e859ef044462a257e1fc76730066"
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4691,5 +4691,34 @@
"Content-Type": "application/json"
}
}
},
{
"httpRequest": {
"path": "/example/httpContentSink",
"method": "POST",
"headers": {
"token": ["9e32e859ef044462a257e1fc76730066"]
},
"body": {
"type": "JSON",
"json": {"content" : "[ {\n \"name\" : \"lzl\",\n \"age\" : 18\n}, {\n \"name\" : \"pizz\",\n \"age\" : 19\n} ]"},
"matchType": "STRICT"
}
},
"httpResponse": {
"body": [
{
"name": "lzl2",
"age": 18
},
{
"name": "pizz2",
"age": 19
}
],
"headers": {
"Content-Type": "application/json"
}
}
}
]