Skip to content

Commit

Permalink
Revert making request to absolute URLS.
Browse files Browse the repository at this point in the history
- add http prefix from backend itself.
  • Loading branch information
StarKhan6368 committed Oct 18, 2024
1 parent 7f4b5ed commit 852a34f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ExamplesInteractiveServer(
}

private fun getServerHostPort(request: ExamplePageRequest? = null) : String {
return request?.hostPort ?: "localhost:$serverPort"
return request?.hostPort ?: "http://localhost:$serverPort"
}

private val environment = applicationEngineEnvironment {
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/resources/templates/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ <h2 th:text="${contractFilePath}"></h2>

async function generateExample(pathInfo) {
try {
const resp = await fetch(`http://${getHostPort()}/_specmatic/examples/generate`, {
const resp = await fetch(`${getHostPort()}/_specmatic/examples/generate`, {
method: "POST",
body: JSON.stringify(pathInfo),
headers: {
Expand All @@ -1575,7 +1575,7 @@ <h2 th:text="${contractFilePath}"></h2>

async function validateExample(exampleFile) {
try {
const resp = await fetch(`http://${getHostPort()}/_specmatic/examples/validate`, {
const resp = await fetch(`${getHostPort()}/_specmatic/examples/validate`, {
method: "POST",
body: JSON.stringify({ exampleFile }),
headers: {
Expand All @@ -1593,7 +1593,7 @@ <h2 th:text="${contractFilePath}"></h2>
async function getExampleContent(example) {
const exampleFileName = encodeURIComponent(example);
try {
const resp = await fetch(`http://${getHostPort()}/_specmatic/examples/content?fileName=${exampleFileName}`)
const resp = await fetch(`${getHostPort()}/_specmatic/examples/content?fileName=${exampleFileName}`)
const data = await resp.json();

if (!resp.ok) {
Expand All @@ -1608,7 +1608,7 @@ <h2 th:text="${contractFilePath}"></h2>

async function testExample(exampleData) {
try {
const resp = await fetch(`http://${getHostPort()}/_specmatic/examples/test`, {
const resp = await fetch(`${getHostPort()}/_specmatic/examples/test`, {
method: "POST",
body: JSON.stringify(exampleData),
headers: {
Expand Down

0 comments on commit 852a34f

Please sign in to comment.