nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: honeycombio/beeline-nodejs
Pull request #348 (2021-05-07 22:58:02)

Make api.withTrace's type signature match api.startTrace
Previously, `api.withTrace` did not accept a `propagatedContext`
parameter, so the call to `apiImpl.startTrace` was pushing a context
stack record with an `undefined` trace context. This would break
`api.addTraceContext` with the error:

    honeycomb-beeline/lib/api/libhoney.js:314
      Object.assign(context.traceContext, map);
             ^
    TypeError: Cannot convert undefined or null to object

This patch fixes the issue by making the type signature of
`api.withTrace` match that of `api.startTrace`, thereby giving the
`propagatedContext` parameter a default value that gets passed along.

`api.addTraceContext` isn't exercised very thoroughly by the tests
as-is, but I added a quick regression test for the synchronous API bug.

vreynolds: LGTM! @ajvondrak can you rebase?
ajvondrak: @vreynolds Pushed!

Patch:
diff --git a/lib/api/index.js b/lib/api/index.js
index e30e0a5..ece86ac 100644
--- a/lib/api/index.js
+++ b/lib/api/index.js
@@ -100,8 +100,21 @@ module.exports = {
   finishTrace(trace) {
     return apiImpl.finishTrace(trace);
   },
-  withTrace(metadataContext, fn, withTraceId, withParentSpanId, withDataset) {
-    const trace = apiImpl.startTrace(metadataContext, withTraceId, withParentSpanId, withDataset);
+  withTrace(
+    metadataContext,
+    fn,
+    withTraceId,
+    withParentSpanId,
+    withDataset,
+    propagatedContext = {}
+  ) {
+    const trace = apiImpl.startTrace(
+      metadataContext,
+      withTraceId,
+      withParentSpanId,
+      withDataset,
+      propagatedContext
+    );
     try {
       return fn();
     } finally {
diff --git a/lib/types.d.ts b/lib/types.d.ts
index 9adbea1..fe054b6 100644
--- a/lib/types.d.ts
+++ b/lib/types.d.ts
@@ -114,7 +114,8 @@ declare namespace beeline {
       fn: SpanFn<F>,
       traceId?: string,
       parentSpanId?: string,
-      dataset?: string
+      dataset?: string,
+      propagatedContext?: MetadataContext
     ): F;
 
     startSpan(metadataContext?: MetadataContext): Span | undefined;


Test patch:
diff --git a/lib/api/index.test.js b/lib/api/index.test.js
index ef8d5a3..829b1a9 100644
--- a/lib/api/index.test.js
+++ b/lib/api/index.test.js
@@ -724,3 +724,14 @@ test("traceContext, no prefix on incoming trace context, dataset behaves as expe
   // dataset goes through as expected
   expect(honey.transmission.events[0].dataset).toBe("test_dataset");
 });
+
+test("addTraceContext works inside of withTrace", () => {
+  const honey = api._apiForTesting().honey;
+
+  api.withTrace({ name: "trace" }, () => {
+    api.addTraceContext({ foo: "bar" });
+  });
+
+  expect(honey.transmission.events.length).toBe(1);
+  expect(honey.transmission.events[0].postData["app.foo"]).toBe("bar");
+});
Repository: postmanlabs/postman-code-generators
Pull request #42 (2019-07-08 07:17:45)

Syntax mode test and fixes
Added syntax_mode to shelll-httpie.
Added structure test at common repo level for same.


Patch:
diff --git a/check.js b/check.js
deleted file mode 100644
index e69de29..0000000
diff --git a/codegens/shell-httpie/package.json b/codegens/shell-httpie/package.json
index 4003dfc..1c772fc 100644
--- a/codegens/shell-httpie/package.json
+++ b/codegens/shell-httpie/package.json
@@ -5,7 +5,8 @@
   "com_postman_plugin": {
     "type": "code_generator",
     "lang": "shell",
-    "variant": "Httpie"
+    "variant": "Httpie",
+    "syntax_mode": "powershell"
   },
   "main": "index.js",
   "directories": {


Test patch:
diff --git a/test/codegen/structure.test.js b/test/codegen/structure.test.js
index ea15ef0..9c511e6 100644
--- a/test/codegen/structure.test.js
+++ b/test/codegen/structure.test.js
@@ -108,6 +108,7 @@ describe('Code-gen repository ' + codegen, function () {
         expect(json.com_postman_plugin).to.have.property('lang');
         expect(json.com_postman_plugin).to.have.property('type');
         expect(json.com_postman_plugin).to.have.property('variant');
+        expect(json.com_postman_plugin).to.have.property('syntax_mode');
         expect(json).to.have.property('engines');
         expect(json.engines).to.eql({
           node: '>=8'
Repository: postmanlabs/postman-code-generators
Pull request #45 (2019-07-10 08:21:02)

Csharp-RestSharp follow redirects fix
- Added support for followRedirects options.
- Added failing test for the same.


Patch:
diff --git a/codegens/csharp-restsharp/lib/restsharp.js b/codegens/csharp-restsharp/lib/restsharp.js
index 149ce08..5db7ba5 100644
--- a/codegens/csharp-restsharp/lib/restsharp.js
+++ b/codegens/csharp-restsharp/lib/restsharp.js
@@ -25,6 +25,9 @@ function makeSnippet (request, options) {
   else {
     snippet += 'client.Timeout = -1;\n';
   }
+  if (!options.followRedirect) {
+    snippet += 'client.FollowRedirects = false;\n';
+  }
   snippet += `var request = new RestRequest(${isUnSupportedMethod ? '' : ('Method.' + request.method)});\n`;
   snippet += parseRequest.parseHeader(request.toJSON(), options.trimRequestBody);
   snippet += parseRequest.parseBody(request, options.trimRequestBody);


Test patch:
diff --git a/codegens/csharp-restsharp/test/unit/convert.test.js b/codegens/csharp-restsharp/test/unit/convert.test.js
index 7ea457a..606cf17 100644
--- a/codegens/csharp-restsharp/test/unit/convert.test.js
+++ b/codegens/csharp-restsharp/test/unit/convert.test.js
@@ -241,6 +241,16 @@ describe('csharp restsharp function', function () {
       });
     });
 
+    it('should add client FollowRedirects configurations when followRedirects is set to false', function () {
+      convert(request, {followRedirect: false}, function (error, snippet) {
+        if (error) {
+          expect.fail(null, null, error);
+        }
+        expect(snippet).to.be.a('string');
+        expect(snippet).to.include('client.FollowRedirects = false');
+      });
+    });
+
   });
 
   describe('getOptions function', function () {
Repository: postmanlabs/postman-code-generators
Pull request #54 (2019-07-15 12:00:03)

Fixed formdata header bug in python-http.client
Fixed a bug which failed snippet generation when body mode is formdata with non zero headers


Patch:
diff --git a/codegens/python-http.client/lib/python-httpclient.js b/codegens/python-http.client/lib/python-httpclient.js
index 2f81e7d..e675ded 100644
--- a/codegens/python-http.client/lib/python-httpclient.js
+++ b/codegens/python-http.client/lib/python-httpclient.js
@@ -22,7 +22,7 @@ function getheaders (request, indentation) {
             `'${sanitize(headerObject[key], 'header')}'`;
     });
     if (requestBodyMode === 'formdata') {
-      headerMap.push(`${indent}'Content-type': 'multipart/form-data; boundary={}'.format(boundary)`);
+      headerMap.push(`${indentation}'Content-type': 'multipart/form-data; boundary={}'.format(boundary)`);
     }
     return `headers = {\n${headerMap.join(',\n')}\n}\n`;
   }


Test patch:
diff --git a/codegens/python-http.client/test/unit/converter.test.js b/codegens/python-http.client/test/unit/converter.test.js
index afad0df..faa8468 100644
--- a/codegens/python-http.client/test/unit/converter.test.js
+++ b/codegens/python-http.client/test/unit/converter.test.js
@@ -223,6 +223,40 @@ describe('Python-http.client converter', function () {
       });
     });
 
+    it('should generate snippet with correct indent when body mode is formdata', function () {
+      var request = new sdk.Request({
+        'method': 'GET',
+        'header': [
+          {
+            'key': 'my-sample-header',
+            'value': 'Lorem ipsum dolor sit amet'
+          }
+        ],
+        'body': {
+          'mode': 'formdata',
+          'formdata': []
+        },
+        'url': {
+          'raw': 'https://postman-echo.com/headers',
+          'protocol': 'https',
+          'host': [
+            'postman-echo',
+            'com'
+          ],
+          'path': [
+            'headers'
+          ]
+        }
+      });
+      convert(request, { indentType: 'space', indentCount: 2}, function (error, snippet) {
+        if (error) {
+          expect.fail(null, null, error);
+        }
+        expect(snippet).to.be.a('string');
+        expect(snippet).to.include('  \'Content-type\': \'multipart/form-data; boundary={}\'.format(boundary)');
+      });
+    });
+
   });
 
   describe('parseBody function', function () {