norn-cli 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to the "Norn" extension will be documented in this file.
4
4
 
5
+ ## [1.3.4] - 2026-02-09
6
+
7
+ ### Fixed
8
+ - **Header Groups with Raw URLs**: Header groups now work with regular URL requests, not just endpoint syntax
9
+ - `GET https://example.com/api Json` now correctly applies the Json header group
10
+ - Header groups on separate lines after URL also work
11
+ - Both extension and CLI support this fix
12
+
5
13
  ## [1.3.3] - 2026-02-08
6
14
 
7
15
  ### Fixed
package/dist/cli.js CHANGED
@@ -26686,6 +26686,64 @@ function parsePropertyAssignment(line2) {
26686
26686
 
26687
26687
  // src/sequenceRunner.ts
26688
26688
  init_assertionRunner();
26689
+ function applyHeaderGroupsToRequest(parsed, requestText, headerGroups, variables) {
26690
+ const lines = requestText.split("\n");
26691
+ const headerGroupNames = headerGroups.map((hg) => hg.name);
26692
+ const headerGroupHeaders = {};
26693
+ const foundGroups = [];
26694
+ for (const line2 of lines) {
26695
+ const trimmed = line2.trim();
26696
+ if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith("var ")) {
26697
+ continue;
26698
+ }
26699
+ const methodMatch = trimmed.match(/^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+(.+)$/i);
26700
+ if (methodMatch) {
26701
+ const afterMethod = methodMatch[2];
26702
+ const tokens = afterMethod.split(/\s+/);
26703
+ for (let i = tokens.length - 1; i >= 0; i--) {
26704
+ if (headerGroupNames.includes(tokens[i])) {
26705
+ foundGroups.push(tokens[i]);
26706
+ } else {
26707
+ break;
26708
+ }
26709
+ }
26710
+ continue;
26711
+ }
26712
+ if (/^[A-Za-z0-9\-_]+\s*:\s*.+$/.test(trimmed)) {
26713
+ continue;
26714
+ }
26715
+ if (trimmed.startsWith("{") || trimmed.startsWith("[") || trimmed.startsWith('"')) {
26716
+ continue;
26717
+ }
26718
+ const potentialGroups = trimmed.split(/\s+/);
26719
+ for (const groupName of potentialGroups) {
26720
+ if (headerGroupNames.includes(groupName)) {
26721
+ foundGroups.push(groupName);
26722
+ }
26723
+ }
26724
+ }
26725
+ for (const groupName of foundGroups) {
26726
+ const group = headerGroups.find((hg) => hg.name === groupName);
26727
+ if (group) {
26728
+ const resolvedHeaders = resolveHeaderValues(group, variables);
26729
+ Object.assign(headerGroupHeaders, resolvedHeaders);
26730
+ }
26731
+ }
26732
+ let modifiedUrl = parsed.url;
26733
+ for (const groupName of foundGroups) {
26734
+ const endPattern = new RegExp(`\\s+${groupName}$`);
26735
+ modifiedUrl = modifiedUrl.replace(endPattern, "");
26736
+ }
26737
+ modifiedUrl = modifiedUrl.trim();
26738
+ const result = {
26739
+ ...parsed,
26740
+ url: modifiedUrl
26741
+ };
26742
+ if (Object.keys(headerGroupHeaders).length > 0) {
26743
+ result.headers = { ...headerGroupHeaders, ...parsed.headers };
26744
+ }
26745
+ return result;
26746
+ }
26689
26747
  function isRunNamedRequestCommand(line2) {
26690
26748
  const trimmed = line2.trim();
26691
26749
  if (!trimmed.toLowerCase().startsWith("run ")) {
@@ -28721,10 +28779,16 @@ async function runSequenceWithJar(sequenceContent, fileVariables, cookieJar, wor
28721
28779
  } else {
28722
28780
  parsed = parserHttpRequest(step.content, runtimeVariables);
28723
28781
  requestDescription = `${parsed.method} ${parsed.url}`;
28782
+ if (apiDefinitions && apiDefinitions.headerGroups.length > 0) {
28783
+ parsed = applyHeaderGroupsToRequest(parsed, step.content, apiDefinitions.headerGroups, runtimeVariables);
28784
+ }
28724
28785
  }
28725
28786
  } else {
28726
28787
  parsed = parserHttpRequest(step.content, runtimeVariables);
28727
28788
  requestDescription = `${parsed.method} ${parsed.url}`;
28789
+ if (apiDefinitions && apiDefinitions.headerGroups.length > 0) {
28790
+ parsed = applyHeaderGroupsToRequest(parsed, step.content, apiDefinitions.headerGroups, runtimeVariables);
28791
+ }
28728
28792
  }
28729
28793
  const { retryCount, backoffMs } = extractRetryOptions(step.content);
28730
28794
  const retryOpts = retryCount ?? parsed.retryCount ? {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "norn-cli",
3
3
  "displayName": "Norn - REST Client",
4
4
  "description": "A powerful REST client for making HTTP requests with sequences, variables, scripts, and cookie support",
5
- "version": "1.3.3",
5
+ "version": "1.3.4",
6
6
  "publisher": "Norn-PeterKrustanov",
7
7
  "author": {
8
8
  "name": "Peter Krastanov"