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

Commit

Permalink
fix(converter): make a case-insensitive comparison for a folders
Browse files Browse the repository at this point in the history
closes #26
  • Loading branch information
derevnjuk committed Jun 2, 2020
1 parent d15ac55 commit 89683e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions __tests__/parse-swagger-doc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const { parseSwaggerDoc } = require('../src/converter')
test('should return empty entries', () => {
const swagger = {
paths: {
'x-swagger-router-controller': 'health',
'/emojis': {
'x-swagger-router-controller': 'health'
}
},
}
const entries = parseSwaggerDoc(swagger, 'https://example.com')
Expand All @@ -13,8 +15,8 @@ test('should return empty entries', () => {
test('should skip x-swagger-router-controller from paths', () => {
const swagger = {
paths: {
'x-swagger-router-controller': 'health',
'/emojis': {
'x-swagger-router-controller': 'health',
get: {
parameters: [
{
Expand Down
8 changes: 4 additions & 4 deletions src/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,11 @@ const parseSwaggerDoc = (swagger, baseUrl) => {
const harList = []

for (const path in swagger.paths) {
if (path.startsWith('x-swagger-router-controller')) {
continue
}

for (const method in swagger.paths[path]) {
if (method && method.toLowerCase().startsWith('x-swagger-router-controller')) {
continue
}

const url = removeTrailingSlash(baseUrl) + '/' + removeLeadingSlash(path)
const har = createHar(swagger, baseUrl, path, method)

Expand Down

0 comments on commit 89683e9

Please sign in to comment.