Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Polyfill Object.setPrototypeOf #44

Merged
merged 3 commits into from
Oct 11, 2019

Conversation

bookmoons
Copy link
Contributor

Polyfills the Object.setPrototypeOf method when a conversion uses any dependency requiring it.

Fixes broken loading of dependencies cheerio xml2js aws4.

Closes #43.

Polyfills the Object.setPrototypeOf method when a conversion
uses any dependency requiring it.
@bookmoons
Copy link
Contributor Author

Here's a collection that triggers loading of all external libraries. In my tests the resulting JS loads and executes successfully.

{
	"info": {
		"_postman_id": "9b0cc8d3-04d1-4196-87a0-3af92541f760",
		"name": "Depends",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "TestDepends",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"id": "f3c1e91d-0c0c-481f-b841-a5d067d40a48",
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"id": "d7a05bac-89c9-4c48-aadc-472bc6631e6d",
						"exec": [
							"const cheerio = require('cheerio')",
							"const _ = require('lodash')",
							"const cryptoJs = require('crypto-js')",
							"",
							"const json = xml2Json(\"<html></html>\")",
							"pm.test('test body', function () {",
							"    pm.expect('Response body').to.include('Response')",
							"    pm.response.to.have.jsonSchema({})",
							"})",
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "awsv4",
					"awsv4": [
						{
							"key": "secretKey",
							"value": "secret",
							"type": "string"
						},
						{
							"key": "accessKey",
							"value": "key",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{protocol}}://example.com?Action=List",
					"protocol": "{{protocol}}",
					"host": [
						"example",
						"com"
					],
					"query": [
						{
							"key": "Action",
							"value": "List"
						}
					]
				}
			},
			"response": []
		}
	],
	"variable": [
		{
			"id": "6148a217-db3c-4c2d-9807-992aab6ec48b",
			"key": "protocol",
			"value": "https",
			"type": "string"
		}
	],
	"protocolProfileBehavior": {}
}

@bookmoons bookmoons mentioned this pull request Oct 11, 2019
@robingustafsson
Copy link
Member

LGTM. Merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Object.setPrototypeOf() unavailable
2 participants