Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-nameservice
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-nameservice
Commits
aebe2fdf
Commit
aebe2fdf
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
nameservice: set all responses to JSON content-type
Change-Id: I57e07aa36842354e9900075dfe19a63a9fb63a51
parent
01cb3376
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
index.js
+7
-5
7 additions, 5 deletions
index.js
with
7 additions
and
5 deletions
index.js
+
7
−
5
View file @
aebe2fdf
#!/usr/bin/env node
'
use strict
'
;
var
connect
=
require
(
'
connect
'
);
var
express
=
require
(
'
express
'
);
var
bodyParser
=
require
(
'
body-parser
'
);
...
...
@@ -9,7 +11,7 @@ var Web3 = require('web3');
var
web3
=
new
Web3
();
Object
.
getPrototypeOf
(
web3
.
eth
).
awaitConsensus
=
function
(
txhash
,
mined_cb
)
{
ethP
=
this
;
var
ethP
=
this
;
var
tries
=
5
;
var
filter
=
this
.
filter
(
'
latest
'
);
filter
.
watch
(
function
(
error
,
result
)
{
...
...
@@ -178,10 +180,13 @@ function startServer() {
var
app
=
express
();
app
.
disable
(
'
x-powered-by
'
);
app
.
use
(
bodyParser
.
json
());
app
.
use
(
function
(
req
,
res
,
next
)
{
res
.
setHeader
(
'
Content-Type
'
,
'
application/json
'
);
next
();
});
// Register name lookup handler
app
.
get
(
"
/name/:name
"
,
function
(
req
,
http_res
)
{
http_res
.
setHeader
(
'
Content-Type
'
,
'
application/json
'
);
try
{
reg
.
addr
(
req
.
params
.
name
,
function
(
err
,
res
)
{
try
{
...
...
@@ -205,7 +210,6 @@ function startServer() {
// Register owner lookup handler
app
.
get
(
"
/name/:name/owner
"
,
function
(
req
,
http_res
)
{
http_res
.
setHeader
(
'
Content-Type
'
,
'
application/json
'
);
try
{
reg
.
owner
(
req
.
params
.
name
,
function
(
err
,
res
)
{
try
{
...
...
@@ -230,7 +234,6 @@ function startServer() {
// Register address lookup handler
app
.
get
(
"
/addr/:addr
"
,
function
(
req
,
http_res
)
{
http_res
.
setHeader
(
'
Content-Type
'
,
'
application/json
'
);
try
{
var
addr
=
formatAddress
(
req
.
params
.
addr
);
if
(
!
addr
)
{
...
...
@@ -260,7 +263,6 @@ function startServer() {
// Register name registration handler
app
.
post
(
"
/name/:name
"
,
function
(
req
,
http_res
)
{
http_res
.
setHeader
(
'
Content-Type
'
,
'
application/json
'
);
try
{
var
addr
=
formatAddress
(
req
.
body
.
addr
);
if
(
!
addr
)
{
...
...
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