Skip to content
Permalink
Browse files

Newline changes

  • Loading branch information...
Duco
Duco committed Aug 18, 2019
1 parent 908aa04 commit 840523b03a925a90ad4eaf9367a5d6d1039811ed
Showing with 19,479 additions and 19,466 deletions.
  1. +358 −355 .gitignore
  2. +19 −19 Dockerfile
  3. +8 −8 LICENSE.txt
  4. +99 −99 README.md
  5. +52 −52 appveyor.yml
  6. +437 −437 docs/CONDITIONS.md
  7. +17 −17 docs/samples/02-post.yml
  8. +12 −12 docs/samples/04-json.yml
  9. +20 −20 docs/samples/06-basic-auth.yml
  10. +20 −20 docs/samples/08-redirect.yml
  11. +24 −24 docs/samples/10-hostname.yml
  12. +18 −18 docs/samples/12-priority.yml
  13. +11 −11 docs/samples/14.4-dynamic-mode-form-post.yml
  14. +3 −3 gui/.browserslistrc
  15. +17 −17 gui/.eslintrc.js
  16. +21 −21 gui/README.md
  17. +11,652 −11,652 gui/package-lock.json
  18. +17 −17 gui/public/index.html
  19. +2 −2 gui/public/robots.txt
  20. +144 −144 gui/src/components/Request.vue
  21. +91 −91 gui/src/components/RequestBody.vue
  22. +60 −60 gui/src/components/RequestStubExecutionResult.vue
  23. +32 −32 gui/src/components/RequestStubExecutionResultCondition.vue
  24. +77 −77 gui/src/components/Stub.vue
  25. +38 −38 gui/src/css/style.css
  26. +6 −6 gui/src/filters/datetime.js
  27. +5 −5 gui/src/filters/yaml.js
  28. +32 −32 gui/src/functions/downloadHelper.js
  29. +11 −11 gui/src/functions/stringFormat.js
  30. +26 −26 gui/src/registerServiceWorker.js
  31. +22 −22 gui/src/resources.js
  32. +44 −44 gui/src/router.js
  33. +11 −11 gui/src/store/getters.js
  34. +36 −36 gui/src/store/store.js
  35. +19 −19 gui/vue.config.js
  36. +139 −139 logo/logo-white.svg
  37. +11 −11 scripts/Build-NuGet.ps1
  38. +7 −7 scripts/functions.ps1
  39. +50 −50 scripts/install-mac.sh
  40. +120 −120 ...HttPlaceholder.Application.Tests/StubExecution/ConditionChecking/FullPathConditionCheckerFacts.cs
  41. +177 −177 ...HttPlaceholder.Application.Tests/StubExecution/ConditionChecking/JsonPathConditionCheckerFacts.cs
  42. +61 −61 src/HttPlaceholder.Application.Tests/StubExecution/ResponseWriting/Base64ResponseWriterFacts.cs
  43. +73 −73 ...ttPlaceholder.Application.Tests/StubExecution/ResponseWriting/ExtraDurationResponseWriterFacts.cs
  44. +64 −64 src/HttPlaceholder.Application.Tests/StubExecution/ResponseWriting/HeadersResponseWriterFacts.cs
  45. +89 −89 src/HttPlaceholder.Application.Tests/StubExecution/ResponseWriting/JsonResponseWriterFacts.cs
  46. +82 −82 src/HttPlaceholder.Application.Tests/StubExecution/ResponseWriting/StatusCodeResponseWriterFacts.cs
  47. +51 −51 src/HttPlaceholder.Application.Tests/StubExecution/VariableHandling/QueryStringHandlerFacts.cs
  48. +51 −51 ...Placeholder.Application.Tests/StubExecution/VariableHandling/RequestHeaderVariableHandlerFacts.cs
  49. +29 −29 src/HttPlaceholder.Application/HttPlaceholder.Application.csproj
  50. +73 −73 src/HttPlaceholder.Application/Infrastructure/AutoMapper/MapperProfileHelper.cs
  51. +9 −9 src/HttPlaceholder.Application/Interfaces/Authentication/IUserContext.cs
  52. +23 −23 src/HttPlaceholder.Application/Requests/Commands/DeleteAllRequest/DeleteAllRequestsCommandHandler.cs
  53. +10 −10 src/HttPlaceholder.Application/Requests/Queries/GetAllRequests/GetAllRequestsQuery.cs
  54. +22 −22 src/HttPlaceholder.Application/Requests/Queries/GetAllRequests/GetAllRequestsQueryHandler.cs
  55. +40 −40 ...aceholder.Application/StubExecution/ConditionChecking/Implementations/FullPathConditionChecker.cs
  56. +38 −38 ...ttPlaceholder.Application/StubExecution/ConditionChecking/Implementations/HostConditionChecker.cs
  57. +56 −56 ...aceholder.Application/StubExecution/ConditionChecking/Implementations/JsonPathConditionChecker.cs
  58. +40 −40 ...ttPlaceholder.Application/StubExecution/ConditionChecking/Implementations/PathConditionChecker.cs
  59. +11 −11 src/HttPlaceholder.Application/Tenants/Queries/GetStubsInTenant/GetStubsInTenantQuery.cs
  60. +35 −35 src/HttPlaceholder.Application/Users/Queries/GetUserData/GetUserDataQueryHandler.cs
  61. +2,234 −2,234 src/HttPlaceholder.Client/HttPlaceholderClient.cs
  62. +87 −87 src/HttPlaceholder.Client/client.nswag
  63. +20 −20 src/HttPlaceholder.Common/Utilities/StringHelper.cs
  64. +11 −11 src/HttPlaceholder.Configuration/SettingsModel.cs
  65. +66 −66 src/HttPlaceholder.Configuration/Utilities/ConfigurationParser.cs
  66. +15 −15 src/HttPlaceholder.Configuration/WebSettingsModel.cs
  67. +19 −19 src/HttPlaceholder.Domain/Entities/DbRequestModel.cs
  68. +28 −28 src/HttPlaceholder.Domain/Enums/ConditionValidationType.cs
  69. +71 −71 src/HttPlaceholder.Domain/StubConditionsModel.cs
  70. +83 −83 src/HttPlaceholder.Domain/StubResponseModel.cs
  71. +34 −34 src/HttPlaceholder.Domain/StubUrlConditionModel.cs
  72. +90 −90 src/HttPlaceholder.Persistence.Tests/Implementations/StubRootpathResolverFacts.cs
  73. +52 −52 src/HttPlaceholder.Persistence/Db/Implementations/MysqlQueryStore.cs
  74. +18 −18 src/HttPlaceholder.TestUtilities/TestObjectFactory.cs
  75. +24 −24 src/HttPlaceholder.Tests/Infrastructure/AutoMapperFacts.cs
  76. +67 −67 src/HttPlaceholder.Tests/Integration/Stubs/StubBasicAuthIntegrationTests.cs
  77. +37 −37 src/HttPlaceholder.Tests/Integration/Stubs/StubFallbackIntegrationTests.cs
  78. +56 −56 src/HttPlaceholder.Tests/Integration/Stubs/StubGeneralIntegrationTests.cs
  79. +66 −66 src/HttPlaceholder.Tests/Integration/Stubs/StubHttpsIntegrationTests.cs
  80. +107 −107 src/HttPlaceholder.Tests/Integration/Stubs/StubJsonPathConditionsIntegrationTests.cs
  81. +133 −133 src/HttPlaceholder.Tests/Integration/Stubs/StubPostBodyConditionsIntegrationTests.cs
  82. +51 −51 src/HttPlaceholder.Tests/Integration/Stubs/StubRedirectionIntegrationTests.cs
  83. +102 −102 src/HttPlaceholder.Tests/Integration/Stubs/StubRegularResponseIntegrationTests.cs
  84. +132 −132 src/HttPlaceholder.Tests/Integration/Stubs/StubUrlConditionsIntegrationTests.cs
  85. +173 −173 src/HttPlaceholder.Tests/Integration/Stubs/StubXpathConditionsIntegrationTests.cs
  86. +192 −182 src/HttPlaceholder.sln
  87. +89 −89 src/HttPlaceholder/Authorization/ApiAuthorizationAttribute.cs
  88. +24 −24 src/HttPlaceholder/Controllers/MetadataController.cs
  89. +61 −61 src/HttPlaceholder/Controllers/TenantController.cs
  90. +7 −7 src/HttPlaceholder/CookieKeys.cs
  91. +32 −32 src/HttPlaceholder/Dto/Requests/StubExecutionResultDto.cs
  92. +30 −30 src/HttPlaceholder/Dto/Stubs/StubBasicAuthenticationDto.cs
  93. +13 −13 src/HttPlaceholder/Dto/Stubs/StubMetadataDto.cs
  94. +83 −83 src/HttPlaceholder/Dto/Stubs/StubResponseDto.cs
  95. +23 −23 src/HttPlaceholder/Dto/Stubs/StubXpathDto.cs
  96. +66 −66 src/HttPlaceholder/Formatters/YamlInputFormatter.cs
  97. +30 −30 src/HttPlaceholder/Hubs/Implementations/RequestHub.cs
  98. +123 −123 src/HttPlaceholder/Middleware/StubHandlingMiddleware.cs
  99. +69 −69 src/HttPlaceholder/Utilities/StartupUtilities.cs
  100. +15 −15 src/HttPlaceholder/_config.json
  101. +8 −8 vagrant/ubuntu/Vagrantfile
  102. +15 −15 vagrant/windows/Vagrantfile
  103. +1 −1 vagrant/windows/bootstrap.ps1

Large diffs are not rendered by default.

@@ -1,20 +1,20 @@
# Build API
FROM microsoft/dotnet:sdk AS build-env
WORKDIR /app

COPY . ./
RUN cd src/HttPlaceholder && dotnet publish -c Release -o ../../out

# Build UI
FROM node AS gui-build-env
WORKDIR /app

COPY . ./
RUN cd gui && npm install && npm run build

# Build runtime image
FROM microsoft/dotnet:aspnetcore-runtime
WORKDIR /app
COPY --from=build-env /app/out .
COPY --from=gui-build-env /app/gui/dist ./gui
# Build API
FROM microsoft/dotnet:sdk AS build-env
WORKDIR /app

COPY . ./
RUN cd src/HttPlaceholder && dotnet publish -c Release -o ../../out

# Build UI
FROM node AS gui-build-env
WORKDIR /app

COPY . ./
RUN cd gui && npm install && npm run build

# Build runtime image
FROM microsoft/dotnet:aspnetcore-runtime
WORKDIR /app
COPY --from=build-env /app/out .
COPY --from=gui-build-env /app/gui/dist ./gui
ENTRYPOINT ["dotnet", "HttPlaceholder.dll", "--fileStorageLocation", "/app/stubs"]
@@ -1,9 +1,9 @@
Copyright 2018 Duco Winterwerp

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Copyright 2018 Duco Winterwerp
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
198 README.md
@@ -1,100 +1,100 @@
# HttPlaceholder

<img src="logo/logo_single.png" alt="HttPlaceholder" width="150"/>

| | |
| --- | --- |
| **Build** | [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/pq6hojs9bqbmjjy5?svg=true)](https://ci.appveyor.com/project/dukeofharen/httplaceholder) |
| **License** | [![MIT License](https://img.shields.io/:license-mit-green.svg)](https://opensource.org/licenses/MIT) |
| **Tickets** | [Trello](https://trello.com/b/PCZ6K9Hd/httplaceholder) |

Quickly mock away any webservice using HttPlaceholder. HttPlaceholder lets you specify what the request should look like and what response needs to be returned.

# Where?
* ⚙ Install as dotnet tool<br />
`dotnet install --global httplaceholder`
* 🗔 Install on Windows<br />
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/Install-Windows.ps1'))
```
* 🐧 Install on Linux<br />
```bash
curl -o- https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/install-linux.sh | bash
```
* 🍎 Install on Mac OS X<br />
```bash
curl -o- https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/install-mac.sh | bash
```

# Why?
At my current job, we develop and maintain a lot of web applications. These web applications have a lot of dependencies on other web services. So I thought: instead of running all these dependent web services on the local dev machine, why not use a stub to make development easier? That's exactly what I did.

So a few bullet points in a row:

🤠 Define all the needed requests in a YAML file, which can also be checked in for all your team members to use.<br />
🏄‍ Many request conditions take regular expressions, to make your stub even more flexible.<br />
😴 Use the HttPlaceholder REST API to prepare all the requests you need for automated tests.<br />

# How?
You have an input YAML file (which contains 1 or more requests):

```yml
- id: situation-01
conditions:
method: GET
url:
path: /users
query:
id: 12
filter: first_name
response:
statusCode: 200
text: |
{
"first_name": "John"
}
headers:
Content-Type: application/json
```

In the `conditions` element, you specify which conditions the request should apply to.
- The method should be `GET`.
- The path of your URL should be '/users'.
- The query parameters `id` and `filter` should be there with the values `12` and `first_name` respectively.

In this case, if you go to the URL http://localhost:5000/users?id=12&filter=first_name, you get the response as defined.

The `response` element defines the response of the request. In this case, HTTP 200 is returned, the literal JSON string defined and `application/json` as Content-Type header. Also take a look at the [samples](docs/SAMPLES.md).

Go to `http://localhost:5000/ph-ui`, you will get to the management interface to see all made requests and all stubs.

![Management UI](docs/img/ui_screenshot.png)

# Batteries included 🔋
- XPath conditions.
- JSONPath conditions.
- Request header conditions.
- Many conditions also take regular expressions.
- Basic authentication conditions.
- Add Base64 and file references to your response, so returning files is also possible.
- Artificially make your responses slower, to simulate slow web servers and test the timeout settings of your application.
- HttPlaceholder can be run under HTTPS.
- REST API to automate the creation of stubs (useful in test scenarios).
- User interface to view stubs and executed requests.
- And more.

# Documentation 📚
* [Installation](docs/INSTALL.md)
* [Getting started](docs/GETTING-STARTED.md)
* [Stub samples](docs/SAMPLES.md)
* [HttPlaceholder REST API](docs/API.md)
* [Configuration](docs/CONFIG.md)
* [Request conditions explained](docs/CONDITIONS.md)
* [Response definitions explained](docs/RESPONSE.md)
* [Management interface](docs/UI.md)

# Tools 🛠
* [HttPlaceholder REST API client for .NET](https://www.nuget.org/packages/HttPlaceholder.Client/)

# Todo
# HttPlaceholder

<img src="logo/logo_single.png" alt="HttPlaceholder" width="150"/>

| | |
| --- | --- |
| **Build** | [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/pq6hojs9bqbmjjy5?svg=true)](https://ci.appveyor.com/project/dukeofharen/httplaceholder) |
| **License** | [![MIT License](https://img.shields.io/:license-mit-green.svg)](https://opensource.org/licenses/MIT) |
| **Tickets** | [Trello](https://trello.com/b/PCZ6K9Hd/httplaceholder) |

Quickly mock away any webservice using HttPlaceholder. HttPlaceholder lets you specify what the request should look like and what response needs to be returned.

# Where?
* ⚙ Install as dotnet tool<br />
`dotnet install --global httplaceholder`
* 🗔 Install on Windows<br />
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/Install-Windows.ps1'))
```
* 🐧 Install on Linux<br />
```bash
curl -o- https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/install-linux.sh | bash
```
* 🍎 Install on Mac OS X<br />
```bash
curl -o- https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/install-mac.sh | bash
```

# Why?
At my current job, we develop and maintain a lot of web applications. These web applications have a lot of dependencies on other web services. So I thought: instead of running all these dependent web services on the local dev machine, why not use a stub to make development easier? That's exactly what I did.

So a few bullet points in a row:

🤠 Define all the needed requests in a YAML file, which can also be checked in for all your team members to use.<br />
🏄‍ Many request conditions take regular expressions, to make your stub even more flexible.<br />
😴 Use the HttPlaceholder REST API to prepare all the requests you need for automated tests.<br />

# How?
You have an input YAML file (which contains 1 or more requests):

```yml
- id: situation-01
conditions:
method: GET
url:
path: /users
query:
id: 12
filter: first_name
response:
statusCode: 200
text: |
{
"first_name": "John"
}
headers:
Content-Type: application/json
```

In the `conditions` element, you specify which conditions the request should apply to.
- The method should be `GET`.
- The path of your URL should be '/users'.
- The query parameters `id` and `filter` should be there with the values `12` and `first_name` respectively.

In this case, if you go to the URL http://localhost:5000/users?id=12&filter=first_name, you get the response as defined.

The `response` element defines the response of the request. In this case, HTTP 200 is returned, the literal JSON string defined and `application/json` as Content-Type header. Also take a look at the [samples](docs/SAMPLES.md).

Go to `http://localhost:5000/ph-ui`, you will get to the management interface to see all made requests and all stubs.

![Management UI](docs/img/ui_screenshot.png)

# Batteries included 🔋
- XPath conditions.
- JSONPath conditions.
- Request header conditions.
- Many conditions also take regular expressions.
- Basic authentication conditions.
- Add Base64 and file references to your response, so returning files is also possible.
- Artificially make your responses slower, to simulate slow web servers and test the timeout settings of your application.
- HttPlaceholder can be run under HTTPS.
- REST API to automate the creation of stubs (useful in test scenarios).
- User interface to view stubs and executed requests.
- And more.

# Documentation 📚
* [Installation](docs/INSTALL.md)
* [Getting started](docs/GETTING-STARTED.md)
* [Stub samples](docs/SAMPLES.md)
* [HttPlaceholder REST API](docs/API.md)
* [Configuration](docs/CONFIG.md)
* [Request conditions explained](docs/CONDITIONS.md)
* [Response definitions explained](docs/RESPONSE.md)
* [Management interface](docs/UI.md)

# Tools 🛠
* [HttPlaceholder REST API client for .NET](https://www.nuget.org/packages/HttPlaceholder.Client/)

# Todo
- There's no way to add custom condition checkers or response writers yet.
@@ -1,53 +1,53 @@
image: Visual Studio 2017

before_build:
- cmd: dotnet --version
- ps: Get-ChildItem -Path "C:\Program Files\dotnet\sdk"
- ps: scripts\Determine-Variables.ps1
- ps: scripts\Patch-Versions.ps1

environment:
access_token:
secure: Zcoti9GsS4Y1t12qVcWhfDXMJLW8QLt4SdeQi8VKUFBtd/gVyWsZlLXDOHLP8i5U
nuget_api_key:
secure: 7EBDqihYRTDxRQzfFeJRYt54OBpZUXWrPCyoMmpCs4+EkUXwxuYp/R4U4CZtsT7z

branches:
only:
- nothing

build_script:
- git submodule update --init --recursive
- ps: scripts\Build.ps1

test: off

skip_tags: true

artifacts:
- path: src\HttPlaceholder\bin\release\netcoreapp2.2\win-x64\publish\httplaceholder_*.exe
name: httplaceholder-windows
type: zip
- path: src\HttPlaceholder.Client\bin\Release\*.nupkg
name: httplaceholder-nuget
type: zip
- path: src\HttPlaceholder\bin\Tool\*.nupkg
name: httplaceholder-tool
type: zip
- path: '**\swagger.json'
name: swagger
type: zip
- path: src\HttPlaceholder\bin\release\netcoreapp2.2\httplaceholder_*.zip
name: httplaceholder-zips
type: zip
- path: src\HttPlaceholder\bin\release\netcoreapp2.2\httplaceholder_*.tar.gz
name: httplaceholder-tars
type: zip

deploy:
release: $(releaseName)
description: $(description)
provider: GitHub
auth_token: $(access_token)
draft: $(draft)
image: Visual Studio 2017

before_build:
- cmd: dotnet --version
- ps: Get-ChildItem -Path "C:\Program Files\dotnet\sdk"
- ps: scripts\Determine-Variables.ps1
- ps: scripts\Patch-Versions.ps1

environment:
access_token:
secure: Zcoti9GsS4Y1t12qVcWhfDXMJLW8QLt4SdeQi8VKUFBtd/gVyWsZlLXDOHLP8i5U
nuget_api_key:
secure: 7EBDqihYRTDxRQzfFeJRYt54OBpZUXWrPCyoMmpCs4+EkUXwxuYp/R4U4CZtsT7z

branches:
only:
- nothing

build_script:
- git submodule update --init --recursive
- ps: scripts\Build.ps1

test: off

skip_tags: true

artifacts:
- path: src\HttPlaceholder\bin\release\netcoreapp2.2\win-x64\publish\httplaceholder_*.exe
name: httplaceholder-windows
type: zip
- path: src\HttPlaceholder.Client\bin\Release\*.nupkg
name: httplaceholder-nuget
type: zip
- path: src\HttPlaceholder\bin\Tool\*.nupkg
name: httplaceholder-tool
type: zip
- path: '**\swagger.json'
name: swagger
type: zip
- path: src\HttPlaceholder\bin\release\netcoreapp2.2\httplaceholder_*.zip
name: httplaceholder-zips
type: zip
- path: src\HttPlaceholder\bin\release\netcoreapp2.2\httplaceholder_*.tar.gz
name: httplaceholder-tars
type: zip

deploy:
release: $(releaseName)
description: $(description)
provider: GitHub
auth_token: $(access_token)
draft: $(draft)
prerelease: $(prerelease)

0 comments on commit 840523b

Please sign in to comment.
You can’t perform that action at this time.