Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
exchangeserve
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Abdulhadi Al-Sayed
exchangeserve
Commits
23a506dd
Commit
23a506dd
authored
Feb 26, 2021
by
Abdulhadi Al-Sayed
Browse files
Options
Downloads
Patches
Plain Diff
Tweaked hyperlink generation for appliance to http and https
parent
94553266
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api_exchange.go
+5
-5
5 additions, 5 deletions
api_exchange.go
cmd/exchange_server
+0
-0
0 additions, 0 deletions
cmd/exchange_server
with
5 additions
and
5 deletions
api_exchange.go
+
5
−
5
View file @
23a506dd
...
@@ -28,7 +28,6 @@ type Diagnose struct {
...
@@ -28,7 +28,6 @@ type Diagnose struct {
HandlerLostUser is a function for guiding lost souls back to the right 'relative' path
HandlerLostUser is a function for guiding lost souls back to the right 'relative' path
*/
*/
func
HandlerLostUser
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
HandlerLostUser
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
protocol
:=
"http://"
// Host protocol
host
:=
r
.
Host
// Host URL
host
:=
r
.
Host
// Host URL
pathAPI
:=
"/exchange/v1/"
// API path
pathAPI
:=
"/exchange/v1/"
// API path
...
@@ -39,9 +38,9 @@ func HandlerLostUser(w http.ResponseWriter, r *http.Request) {
...
@@ -39,9 +38,9 @@ func HandlerLostUser(w http.ResponseWriter, r *http.Request) {
line1
:=
"Hello! You seem lost! Let me help you!"
line1
:=
"Hello! You seem lost! Let me help you!"
line2
:=
"These are some examples:"
line2
:=
"These are some examples:"
history
:=
protocol
+
host
+
pathAPI
+
pathHistory
history
:=
host
+
pathAPI
+
pathHistory
border
:=
protocol
+
host
+
pathAPI
+
pathBorder
border
:=
host
+
pathAPI
+
pathBorder
diagnose
:=
protocol
+
host
+
pathAPI
+
pathDiag
diagnose
:=
host
+
pathAPI
+
pathDiag
// HTML form for response such that URLs are hyperlinks
// HTML form for response such that URLs are hyperlinks
var
form
=
`<p>`
+
line1
+
`</p>
var
form
=
`<p>`
+
line1
+
`</p>
...
@@ -50,7 +49,7 @@ func HandlerLostUser(w http.ResponseWriter, r *http.Request) {
...
@@ -50,7 +49,7 @@ func HandlerLostUser(w http.ResponseWriter, r *http.Request) {
<p><a href="`
+
border
+
`">`
+
border
+
`</a></p>
<p><a href="`
+
border
+
`">`
+
border
+
`</a></p>
<p><a href="`
+
diagnose
+
`">`
+
diagnose
+
`</a></p>`
<p><a href="`
+
diagnose
+
`">`
+
diagnose
+
`</a></p>`
//
//
Generate HTML template from Form
res
:=
template
.
New
(
"table"
)
res
:=
template
.
New
(
"table"
)
res
,
err
:=
res
.
Parse
(
form
)
res
,
err
:=
res
.
Parse
(
form
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -58,6 +57,7 @@ func HandlerLostUser(w http.ResponseWriter, r *http.Request) {
...
@@ -58,6 +57,7 @@ func HandlerLostUser(w http.ResponseWriter, r *http.Request) {
fmt
.
Println
(
"Could not parse HTML form: "
+
err
.
Error
())
fmt
.
Println
(
"Could not parse HTML form: "
+
err
.
Error
())
}
}
// Write template
err
=
res
.
Execute
(
w
,
nil
)
err
=
res
.
Execute
(
w
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
http
.
Error
(
w
,
"Could not process request"
,
http
.
StatusInternalServerError
)
http
.
Error
(
w
,
"Could not process request"
,
http
.
StatusInternalServerError
)
...
...
This diff is collapsed.
Click to expand it.
cmd/exchange_server
+
0
−
0
View file @
23a506dd
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment