This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 46292374fd Fix missing headers in HTTP Acrtion, fixes #5610 (#5886)
46292374fd is described below

commit 46292374fd72489bd3bb7184127cfa3d40ecd734
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Oct 24 12:31:36 2025 +0200

    Fix missing headers in HTTP Acrtion, fixes #5610 (#5886)
---
 .../http/0005-http-action-check-header.hpl         | 228 +++++++++++++--------
 integration-tests/http/main-0005-http-action.hwf   |  72 ++++---
 .../hop/workflow/actions/http/ActionHttp.java      |  10 +-
 3 files changed, 192 insertions(+), 118 deletions(-)

diff --git a/integration-tests/http/0005-http-action-check-header.hpl 
b/integration-tests/http/0005-http-action-check-header.hpl
index 3240e36e44..f167534304 100644
--- a/integration-tests/http/0005-http-action-check-header.hpl
+++ b/integration-tests/http/0005-http-action-check-header.hpl
@@ -34,8 +34,6 @@ limitations under the License.
     <created_date>2021/10/02 18:07:26.904</created_date>
     <modified_user>-</modified_user>
     <modified_date>2021/10/02 18:07:26.904</modified_date>
-    <key_for_session_key/>
-    <is_key_private>N</is_key_private>
   </info>
   <notepads>
   </notepads>
@@ -62,8 +60,8 @@ limitations under the License.
     </hop>
   </order>
   <transform>
-    <name>JSON input</name>
-    <type>JsonInput</type>
+    <name>Abort</name>
+    <type>Abort</type>
     <description/>
     <distribute>Y</distribute>
     <custom_distribution/>
@@ -72,54 +70,12 @@ limitations under the License.
       <method>none</method>
       <schema_name/>
     </partitioning>
-    <include>N</include>
-    <include_field/>
-    <rownum>N</rownum>
-    <addresultfile>N</addresultfile>
-    <readurl>N</readurl>
-    <removeSourceField>N</removeSourceField>
-    <IsIgnoreEmptyFile>Y</IsIgnoreEmptyFile>
-    <doNotFailIfNoFile>Y</doNotFailIfNoFile>
-    <ignoreMissingPath>Y</ignoreMissingPath>
-    <defaultPathLeafToNull>N</defaultPathLeafToNull>
-    <rownum_field/>
-    <file>
-      <name/>
-      <filemask/>
-      <exclude_filemask/>
-      <file_required>N</file_required>
-      <include_subfolders>N</include_subfolders>
-    </file>
-    <fields>
-      <field>
-        <name>testheader</name>
-        <path>$.headers.Test</path>
-        <type>String</type>
-        <format/>
-        <currency/>
-        <decimal/>
-        <group/>
-        <length>-1</length>
-        <precision>-1</precision>
-        <trim_type>none</trim_type>
-        <repeat>N</repeat>
-      </field>
-    </fields>
-    <limit>0</limit>
-    <IsInFields>Y</IsInFields>
-    <IsAFile>Y</IsAFile>
-    <valueField>filename</valueField>
-    <shortFileFieldName/>
-    <pathFieldName/>
-    <hiddenFieldName/>
-    <lastModificationTimeFieldName/>
-    <uriNameFieldName/>
-    <rootUriNameFieldName/>
-    <extensionFieldName/>
-    <sizeFieldName/>
+    <abort_option>ABORT_WITH_ERROR</abort_option>
+    <always_log_rows>Y</always_log_rows>
+    <row_threshold>0</row_threshold>
     <attributes/>
     <GUI>
-      <xloc>400</xloc>
+      <xloc>752</xloc>
       <yloc>64</yloc>
     </GUI>
   </transform>
@@ -134,22 +90,69 @@ limitations under the License.
       <method>none</method>
       <schema_name/>
     </partitioning>
-    <send_true_to/>
-    <send_false_to/>
     <compare>
       <condition>
-        <negated>Y</negated>
-        <leftvalue>testheader</leftvalue>
+        <conditions>
+          <condition>
+            <conditions>
+</conditions>
+            <function>&lt;></function>
+            <leftvalue>testheader</leftvalue>
+            <negated>N</negated>
+            <operator>-</operator>
+            <value>
+              <isnull>N</isnull>
+              <length>-1</length>
+              <name>constant</name>
+              <precision>-1</precision>
+              <text>test</text>
+              <type>String</type>
+            </value>
+          </condition>
+          <condition>
+            <conditions>
+</conditions>
+            <function>&lt;></function>
+            <leftvalue>testheader2</leftvalue>
+            <negated>N</negated>
+            <operator>OR</operator>
+            <value>
+              <isnull>N</isnull>
+              <length>-1</length>
+              <name>constant</name>
+              <precision>-1</precision>
+              <text>test2</text>
+              <type>String</type>
+            </value>
+          </condition>
+          <condition>
+            <conditions>
+</conditions>
+            <function>&lt;></function>
+            <leftvalue>testheader3</leftvalue>
+            <negated>N</negated>
+            <operator>OR</operator>
+            <value>
+              <isnull>N</isnull>
+              <length>-1</length>
+              <name>constant</name>
+              <precision>-1</precision>
+              <text>test3</text>
+              <type>String</type>
+            </value>
+          </condition>
+        </conditions>
         <function>=</function>
-        <rightvalue/>
+        <leftvalue>testheader</leftvalue>
+        <negated>N</negated>
+        <operator>-</operator>
         <value>
-          <name>constant</name>
-          <type>String</type>
-          <text>test</text>
+          <isnull>N</isnull>
           <length>-1</length>
+          <name>constant</name>
           <precision>-1</precision>
-          <isnull>N</isnull>
-          <mask/>
+          <text>test</text>
+          <type>String</type>
         </value>
       </condition>
     </compare>
@@ -160,8 +163,8 @@ limitations under the License.
     </GUI>
   </transform>
   <transform>
-    <name>Abort</name>
-    <type>Abort</type>
+    <name>Generate rows</name>
+    <type>RowGenerator</type>
     <description/>
     <distribute>Y</distribute>
     <custom_distribution/>
@@ -170,19 +173,22 @@ limitations under the License.
       <method>none</method>
       <schema_name/>
     </partitioning>
-    <abort_option>ABORT_WITH_ERROR</abort_option>
-    <always_log_rows>Y</always_log_rows>
-    <message/>
-    <row_threshold>0</row_threshold>
+    <fields>
+</fields>
+    <interval_in_ms>5000</interval_in_ms>
+    <last_time_field>FiveSecondsAgo</last_time_field>
+    <limit>1</limit>
+    <never_ending>N</never_ending>
+    <row_time_field>now</row_time_field>
     <attributes/>
     <GUI>
-      <xloc>752</xloc>
+      <xloc>112</xloc>
       <yloc>64</yloc>
     </GUI>
   </transform>
   <transform>
-    <name>Generate rows</name>
-    <type>RowGenerator</type>
+    <name>Get variables</name>
+    <type>GetVariable</type>
     <description/>
     <distribute>Y</distribute>
     <custom_distribution/>
@@ -192,21 +198,24 @@ limitations under the License.
       <schema_name/>
     </partitioning>
     <fields>
-</fields>
-    <interval_in_ms>5000</interval_in_ms>
-    <last_time_field>FiveSecondsAgo</last_time_field>
-    <never_ending>N</never_ending>
-    <limit>1</limit>
-    <row_time_field>now</row_time_field>
+      <field>
+        <length>-1</length>
+        <name>filename</name>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <type>String</type>
+        <variable>${java.io.tmpdir}/result</variable>
+      </field>
+    </fields>
     <attributes/>
     <GUI>
-      <xloc>112</xloc>
+      <xloc>256</xloc>
       <yloc>64</yloc>
     </GUI>
   </transform>
   <transform>
-    <name>Get variables</name>
-    <type>GetVariable</type>
+    <name>JSON input</name>
+    <type>JsonInput</type>
     <description/>
     <distribute>Y</distribute>
     <custom_distribution/>
@@ -215,10 +224,28 @@ limitations under the License.
       <method>none</method>
       <schema_name/>
     </partitioning>
+    <include>N</include>
+    <include_field/>
+    <rownum>N</rownum>
+    <addresultfile>N</addresultfile>
+    <readurl>N</readurl>
+    <removeSourceField>N</removeSourceField>
+    <IsIgnoreEmptyFile>Y</IsIgnoreEmptyFile>
+    <doNotFailIfNoFile>Y</doNotFailIfNoFile>
+    <ignoreMissingPath>Y</ignoreMissingPath>
+    <defaultPathLeafToNull>N</defaultPathLeafToNull>
+    <rownum_field/>
+    <file>
+      <name/>
+      <filemask/>
+      <exclude_filemask/>
+      <file_required>N</file_required>
+      <include_subfolders>N</include_subfolders>
+    </file>
     <fields>
       <field>
-        <name>filename</name>
-        <variable>${java.io.tmpdir}/result</variable>
+        <name>testheader</name>
+        <path>$.headers.Test</path>
         <type>String</type>
         <format/>
         <currency/>
@@ -227,11 +254,50 @@ limitations under the License.
         <length>-1</length>
         <precision>-1</precision>
         <trim_type>none</trim_type>
+        <repeat>N</repeat>
+      </field>
+      <field>
+        <name>testheader2</name>
+        <path>$.headers.Test2</path>
+        <type>String</type>
+        <format/>
+        <currency/>
+        <decimal/>
+        <group/>
+        <length>-1</length>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <repeat>N</repeat>
+      </field>
+      <field>
+        <name>testheader3</name>
+        <path>$.headers.Test3</path>
+        <type>String</type>
+        <format/>
+        <currency/>
+        <decimal/>
+        <group/>
+        <length>-1</length>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <repeat>N</repeat>
       </field>
     </fields>
+    <limit>0</limit>
+    <IsInFields>Y</IsInFields>
+    <IsAFile>Y</IsAFile>
+    <valueField>filename</valueField>
+    <shortFileFieldName/>
+    <pathFieldName/>
+    <hiddenFieldName/>
+    <lastModificationTimeFieldName/>
+    <uriNameFieldName/>
+    <rootUriNameFieldName/>
+    <extensionFieldName/>
+    <sizeFieldName/>
     <attributes/>
     <GUI>
-      <xloc>256</xloc>
+      <xloc>400</xloc>
       <yloc>64</yloc>
     </GUI>
   </transform>
diff --git a/integration-tests/http/main-0005-http-action.hwf 
b/integration-tests/http/main-0005-http-action.hwf
index 238d9705ff..84a583ea02 100644
--- a/integration-tests/http/main-0005-http-action.hwf
+++ b/integration-tests/http/main-0005-http-action.hwf
@@ -41,14 +41,15 @@ limitations under the License.
       <description/>
       <type>SPECIAL</type>
       <attributes/>
-      <repeat>N</repeat>
-      <schedulerType>0</schedulerType>
-      <intervalSeconds>0</intervalSeconds>
-      <intervalMinutes>60</intervalMinutes>
+      <DayOfMonth>1</DayOfMonth>
+      <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
       <hour>12</hour>
+      <intervalMinutes>60</intervalMinutes>
+      <intervalSeconds>0</intervalSeconds>
       <minutes>0</minutes>
+      <repeat>N</repeat>
+      <schedulerType>0</schedulerType>
       <weekDay>1</weekDay>
-      <DayOfMonth>1</DayOfMonth>
       <parallel>N</parallel>
       <xloc>50</xloc>
       <yloc>48</yloc>
@@ -59,28 +60,37 @@ limitations under the License.
       <description/>
       <type>HTTP</type>
       <attributes/>
-      <url>http://${HOSTNAME}/get</url>
-      <targetfilename>${java.io.tmpdir}/result</targetfilename>
-      <file_appended>N</file_appended>
+      <addfilenameresult>Y</addfilenameresult>
       <date_time_added>N</date_time_added>
-      <targetfilename_extension/>
-      <uploadfilename/>
-      <run_every_row>N</run_every_row>
-      <url_fieldname/>
-      <upload_fieldname/>
       <dest_fieldname/>
-      <username/>
-      <password>Encrypted </password>
-      <proxy_host/>
-      <proxy_port/>
-      <non_proxy_hosts/>
-      <addfilenameresult>Y</addfilenameresult>
+      <file_appended>N</file_appended>
       <headers>
         <header>
           <header_name>test</header_name>
           <header_value>test</header_value>
         </header>
+        <header>
+          <header_name>test2</header_name>
+          <header_value>test2</header_value>
+        </header>
+        <header>
+          <header_name>test3</header_name>
+          <header_value>test3</header_value>
+        </header>
       </headers>
+      <ignore_ssl>N</ignore_ssl>
+      <non_proxy_hosts/>
+      <password>Encrypted </password>
+      <proxy_host/>
+      <proxy_port/>
+      <run_every_row>N</run_every_row>
+      <targetfilename>${java.io.tmpdir}/result</targetfilename>
+      <targetfilename_extension/>
+      <upload_fieldname/>
+      <uploadfilename/>
+      <url>http://${HOSTNAME}/get</url>
+      <url_fieldname/>
+      <username/>
       <parallel>N</parallel>
       <xloc>224</xloc>
       <yloc>48</yloc>
@@ -91,25 +101,22 @@ limitations under the License.
       <description/>
       <type>PIPELINE</type>
       <attributes/>
-      <filename>${PROJECT_HOME}/0005-http-action-check-header.hpl</filename>
-      <params_from_previous>N</params_from_previous>
-      <exec_per_row>N</exec_per_row>
-      <clear_rows>N</clear_rows>
-      <clear_files>N</clear_files>
-      <set_logfile>N</set_logfile>
-      <logfile/>
-      <logext/>
       <add_date>N</add_date>
       <add_time>N</add_time>
-      <loglevel>Basic</loglevel>
-      <set_append_logfile>N</set_append_logfile>
-      <wait_until_finished>Y</wait_until_finished>
-      <follow_abort_remote>N</follow_abort_remote>
+      <clear_files>N</clear_files>
+      <clear_rows>N</clear_rows>
       <create_parent_folder>N</create_parent_folder>
-      <run_configuration>local</run_configuration>
+      <exec_per_row>N</exec_per_row>
+      <filename>${PROJECT_HOME}/0005-http-action-check-header.hpl</filename>
+      <loglevel>Basic</loglevel>
       <parameters>
         <pass_all_parameters>Y</pass_all_parameters>
       </parameters>
+      <params_from_previous>N</params_from_previous>
+      <run_configuration>local</run_configuration>
+      <set_append_logfile>N</set_append_logfile>
+      <set_logfile>N</set_logfile>
+      <wait_until_finished>Y</wait_until_finished>
       <parallel>N</parallel>
       <xloc>400</xloc>
       <yloc>48</yloc>
@@ -120,6 +127,7 @@ limitations under the License.
       <description/>
       <type>ABORT</type>
       <attributes/>
+      <always_log_rows>N</always_log_rows>
       <parallel>N</parallel>
       <xloc>320</xloc>
       <yloc>192</yloc>
diff --git 
a/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java
 
b/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java
index 15115191b1..f86b59556d 100644
--- 
a/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java
+++ 
b/plugins/actions/http/src/main/java/org/apache/hop/workflow/actions/http/ActionHttp.java
@@ -317,17 +317,17 @@ public class ActionHttp extends ActionBase {
             logDebug(BaseMessages.getString(PKG, 
"ActionHTTP.Log.HeadersProvided"));
           }
           for (int j = 0; j < headers.size(); j++) {
-            if (!Utils.isEmpty(headers.get(i).getHeaderValue())) {
+            if (!Utils.isEmpty(headers.get(j).getHeaderValue())) {
               connection.setRequestProperty(
-                  resolve(headers.get(i).getHeaderName()),
-                  resolve(headers.get(i).getHeaderValue()));
+                  resolve(headers.get(j).getHeaderName()),
+                  resolve(headers.get(j).getHeaderValue()));
               if (isDebug()) {
                 logDebug(
                     BaseMessages.getString(
                         PKG,
                         "ActionHTTP.Log.HeaderSet",
-                        resolve(headers.get(i).getHeaderName()),
-                        resolve(headers.get(i).getHeaderValue())));
+                        resolve(headers.get(j).getHeaderName()),
+                        resolve(headers.get(j).getHeaderValue())));
               }
             }
           }

Reply via email to