Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
06b76563
Commit
06b76563
authored
Nov 30, 2015
by
Mathieu Stefani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Response API: function renaming
parent
ad8e24eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
main.cc
main.cc
+1
-1
src/http.h
src/http.h
+11
-2
No files found.
main.cc
View file @
06b76563
...
...
@@ -18,7 +18,7 @@ class MyHandler : public Net::Http::Handler {
.
add
(
std
::
make_shared
<
Header
::
Server
>
(
"lys"
))
.
add
(
std
::
make_shared
<
Header
::
ContentType
>
(
MIME
(
Text
,
Plain
)));
auto
w
=
response
.
writer
(
Net
::
Http
::
Code
::
Ok
);
auto
w
=
response
.
beginWrite
(
Net
::
Http
::
Code
::
Ok
);
std
::
ostream
os
(
w
);
os
<<
"PONG"
;
...
...
src/http.h
View file @
06b76563
...
...
@@ -119,6 +119,10 @@ public:
return
code_
;
}
void
setCode
(
Code
code
)
{
code_
=
code
;
}
std
::
streambuf
*
rdbuf
()
{
return
&
stream_
;
}
...
...
@@ -191,7 +195,11 @@ public:
}
void
setMime
(
const
Mime
::
MediaType
&
mime
)
{
headers
().
add
(
std
::
make_shared
<
Header
::
ContentType
>
(
mime
));
auto
ct
=
headers_
.
tryGet
<
Header
::
ContentType
>
();
if
(
ct
)
ct
->
setMime
(
mime
);
else
headers_
.
add
(
std
::
make_shared
<
Header
::
ContentType
>
(
mime
));
}
Async
::
Promise
<
ssize_t
>
send
(
Code
code
)
{
...
...
@@ -220,8 +228,9 @@ public:
return
w
.
send
();
}
/* @Revisit: not sure about the name yet */
ResponseWriter
writer
(
Code
code
,
size_t
size
=
DefaultStreamSize
)
{
beginWrite
(
Code
code
=
Code
::
Ok
,
size_t
size
=
DefaultStreamSize
)
{
code_
=
code
;
return
ResponseWriter
(
std
::
move
(
*
this
),
size
,
peer_
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment