Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Kong/httpsnippet
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: hoppscotch/httpsnippet
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 9 commits
  • 32 files changed
  • 2 contributors

Commits on Feb 4, 2025

  1. chore: update package

    nivedin committed Feb 4, 2025
    Copy the full SHA
    093995a View commit details
  2. Copy the full SHA
    555174e View commit details
  3. chore: decode full url

    nivedin committed Feb 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0af313a View commit details
  4. Copy the full SHA
    cebda7f View commit details
  5. Copy the full SHA
    8497b5b View commit details
  6. chore: fix markdown lint

    nivedin committed Feb 4, 2025
    Copy the full SHA
    4fea716 View commit details
  7. fix: broken ci

    AndrewBastin authored and nivedin committed Feb 4, 2025
    Copy the full SHA
    2cbee85 View commit details
  8. Copy the full SHA
    1acfcca View commit details
  9. chore: bump version

    nivedin committed Feb 4, 2025
    Copy the full SHA
    40575c4 View commit details
Showing with 73 additions and 50 deletions.
  1. +2 −2 .editorconfig
  2. +28 −0 .github/workflows/hopp-publish.yml
  3. 0 CONTRIBUTING.md → CONTRIBUTING.MD
  4. +0 −9 SECURITY.md
  5. +4 −4 package-lock.json
  6. +10 −8 package.json
  7. +3 −1 src/httpsnippet.ts
  8. +1 −1 src/targets/c/libcurl/fixtures/nested.c
  9. +1 −1 src/targets/csharp/httpclient/fixtures/nested.cs
  10. +2 −2 src/targets/csharp/restsharp/fixtures/nested.cs
  11. +1 −1 src/targets/go/native/fixtures/nested.go
  12. +1 −1 src/targets/java/asynchttp/fixtures/nested.java
  13. +1 −1 src/targets/java/nethttp/fixtures/nested.java
  14. +1 −1 src/targets/java/okhttp/fixtures/nested.java
  15. +1 −1 src/targets/java/unirest/fixtures/nested.java
  16. +1 −1 src/targets/javascript/fetch/fixtures/nested.js
  17. +1 −1 src/targets/javascript/jquery/fixtures/nested.js
  18. +1 −1 src/targets/javascript/xhr/fixtures/nested.js
  19. +1 −1 src/targets/kotlin/okhttp/fixtures/nested.kt
  20. +1 −1 src/targets/node/fetch/fixtures/nested.js
  21. +1 −1 src/targets/objc/nsurlsession/fixtures/nested.m
  22. +1 −1 src/targets/ocaml/cohttp/fixtures/nested.ml
  23. +1 −1 src/targets/php/curl/fixtures/nested.php
  24. +1 −1 src/targets/php/guzzle/fixtures/nested.php
  25. +1 −1 src/targets/powershell/restmethod/fixtures/nested.ps1
  26. +1 −1 src/targets/powershell/webrequest/fixtures/nested.ps1
  27. +1 −1 src/targets/ruby/native/fixtures/nested.rb
  28. +1 −1 src/targets/shell/curl/fixtures/dont-deglob.sh
  29. +1 −1 src/targets/shell/curl/fixtures/nested.sh
  30. +1 −1 src/targets/shell/httpie/fixtures/nested.sh
  31. +1 −1 src/targets/shell/wget/fixtures/nested.sh
  32. +1 −1 src/targets/swift/nsurlsession/fixtures/nested.swift
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
trim_trailing_whitespace = false
insert_final_newline = false

[targets/**/fixtures/*]
insert_final_newline = false
28 changes: 28 additions & 0 deletions .github/workflows/hopp-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Package to NPM

on:
release:
types: [published]

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
registry-url: "https://registry.npmjs.org"

- run: npm install
- run: npm run build

- name: Publish package
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_ACCESS_TOKEN }}
File renamed without changes.
9 changes: 0 additions & 9 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -4,15 +4,6 @@

At HTTPSnippet, we take security issues very seriously. If you believe you have found a security vulnerability in our project, we encourage you to disclose it responsibly. Please report any potential security vulnerabilities to us by sending an email to [vulnerability@konghq.com](mailto:vulnerability@konghq.com).

## How to Report

1. **Do not publicly disclose the vulnerability**: Please do not create a GitHub issue or post the vulnerability on public forums. Instead, contact us directly at [vulnerability@konghq.com](mailto:vulnerability@konghq.com).
1. **Provide detailed information**: When reporting a vulnerability, please include as much information as possible to help us understand and reproduce the issue. This may include:
- Description of the vulnerability
- Steps to reproduce the issue
- Potential impact
- Any relevant logs or screenshots

## What to Expect

- **Acknowledgment**: We will acknowledge receipt of your vulnerability report within 48 hours.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": "3.0.9",
"name": "httpsnippet",
"version": "3.0.7",
"name": "@hoppscotch/httpsnippet",
"description": "HTTP Request snippet generator for *most* languages",
"author": "Kong <office@konghq.com>",
"homepage": "https://github.com/Kong/httpsnippet",
"author": "Hoppscotch Team <support@hoppscotch.io>",
"homepage": "https://github.com/Hoppscotch/httpsnippet",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -41,11 +41,11 @@
"xmlhttprequest"
],
"engines": {
"node": "^14.19.1 || ^16.14.2 || ^18.0.0 || ^20.0.0"
"node": "^14.19.1 || ^16.14.2 || ^18.0.0 "
},
"repository": "Kong/httpsnippet",
"repository": "Hoppscotch/httpsnippet",
"bugs": {
"url": "https://github.com/Kong/httpsnippet/issues"
"url": "https://github.com/Hoppscotch/httpsnippet/issues"
},
"scripts": {
"clean": "tsc --build tsconfig.build.json --clean",
@@ -60,7 +60,9 @@
"lint:markdown:fix": "markdownlint-cli2-fix \"**/*.md\" \"#**/node_modules\"",
"build": "tsc --build tsconfig.build.json",
"build:types": "tsc -d --declarationDir dist/lib --declarationMap --emitDeclarationOnly",
"test": "jest"
"test": "jest",
"dev": "tsc --watch --preserveWatchOutput",
"test:watch": "jest --watch"
},
"devDependencies": {
"@types/eslint": "^8.4.1",
4 changes: 3 additions & 1 deletion src/httpsnippet.ts
Original file line number Diff line number Diff line change
@@ -312,10 +312,12 @@ export class HTTPSnippet {
...uriObj,
}); //?

const decodedFullUrl = decodeURIComponent(fullUrl);

return {
...request,
allHeaders,
fullUrl,
fullUrl: decodedFullUrl,
url,
uriObj,
};
2 changes: 1 addition & 1 deletion src/targets/c/libcurl/fixtures/nested.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value");
curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value");

CURLcode ret = curl_easy_perform(hnd);
2 changes: 1 addition & 1 deletion src/targets/csharp/httpclient/fixtures/nested.cs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"),
RequestUri = new Uri("http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value"),
};
using (var response = await client.SendAsync(request))
{
4 changes: 2 additions & 2 deletions src/targets/csharp/restsharp/fixtures/nested.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var client = new RestClient("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value");
var client = new RestClient("http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
var response = client.Execute(request);
2 changes: 1 addition & 1 deletion src/targets/go/native/fixtures/nested.go
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import (

func main() {

url := "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"
url := "http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value"

req, _ := http.NewRequest("GET", url, nil)

2 changes: 1 addition & 1 deletion src/targets/java/asynchttp/fixtures/nested.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")
client.prepare("GET", "http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
2 changes: 1 addition & 1 deletion src/targets/java/nethttp/fixtures/nested.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"))
.uri(URI.create("http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
2 changes: 1 addition & 1 deletion src/targets/java/okhttp/fixtures/nested.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
.url("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")
.url("http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value")
.get()
.build();

2 changes: 1 addition & 1 deletion src/targets/java/unirest/fixtures/nested.java
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
HttpResponse<String> response = Unirest.get("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")
HttpResponse<String> response = Unirest.get("http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value")
.asString();
2 changes: 1 addition & 1 deletion src/targets/javascript/fetch/fixtures/nested.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const url = 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value';
const url = 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value';
const options = {method: 'GET'};

try {
2 changes: 1 addition & 1 deletion src/targets/javascript/jquery/fixtures/nested.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const settings = {
async: true,
crossDomain: true,
url: 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value',
url: 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value',
method: 'GET',
headers: {}
};
2 changes: 1 addition & 1 deletion src/targets/javascript/xhr/fixtures/nested.js
Original file line number Diff line number Diff line change
@@ -9,6 +9,6 @@ xhr.addEventListener('readystatechange', function () {
}
});

xhr.open('GET', 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value');
xhr.open('GET', 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value');

xhr.send(data);
2 changes: 1 addition & 1 deletion src/targets/kotlin/okhttp/fixtures/nested.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
val client = OkHttpClient()

val request = Request.Builder()
.url("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")
.url("http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value")
.get()
.build()

2 changes: 1 addition & 1 deletion src/targets/node/fetch/fixtures/nested.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fetch = require('node-fetch');

const url = 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value';
const url = 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value';
const options = {method: 'GET'};

try {
2 changes: 1 addition & 1 deletion src/targets/objc/nsurlsession/fixtures/nested.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"]
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
2 changes: 1 addition & 1 deletion src/targets/ocaml/cohttp/fixtures/nested.ml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value" in
let uri = Uri.of_string "http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value" in

Client.call `GET uri
>>= fun (res, body_stream) ->
2 changes: 1 addition & 1 deletion src/targets/php/curl/fixtures/nested.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value",
CURLOPT_URL => "http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
2 changes: 1 addition & 1 deletion src/targets/php/guzzle/fixtures/nested.php
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value');
$response = $client->request('GET', 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value');

echo $response->getBody();
2 changes: 1 addition & 1 deletion src/targets/powershell/restmethod/fixtures/nested.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' -Method GET
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value' -Method GET
2 changes: 1 addition & 1 deletion src/targets/powershell/webrequest/fixtures/nested.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' -Method GET
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value' -Method GET
2 changes: 1 addition & 1 deletion src/targets/ruby/native/fixtures/nested.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'uri'
require 'net/http'

url = URI("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")
url = URI("http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value")

http = Net::HTTP.new(url.host, url.port)

2 changes: 1 addition & 1 deletion src/targets/shell/curl/fixtures/dont-deglob.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
curl --request GET --url 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'
curl --request GET --url 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value'
2 changes: 1 addition & 1 deletion src/targets/shell/curl/fixtures/nested.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
curl --request GET \
--url 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'
--url 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value'
2 changes: 1 addition & 1 deletion src/targets/shell/httpie/fixtures/nested.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
http GET 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'
http GET 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value'
2 changes: 1 addition & 1 deletion src/targets/shell/wget/fixtures/nested.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wget --quiet \
--method GET \
--output-document \
- 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'
- 'http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value'
2 changes: 1 addition & 1 deletion src/targets/swift/nsurlsession/fixtures/nested.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")! as URL,
let request = NSMutableURLRequest(url: NSURL(string: "http://mockbin.com/har?foo[bar]=baz,zap&fiz=buz&key=value")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"