Make POST request to create new post in topic
sendPostMessage(message: Message, user: User): Observable<Message> {
let headers = new Headers({
'Content-Type': 'multipart/form-data',
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Origin': '*',
'cache-control': 'no-cache',
'Access-Control-Allow-Methods': 'POST, OPTIONS',
});
let messageBody = {
topic_id: message.topic_id,
raw: message.raw,
api_key: user.api_key,
api_username: user.api_username
}
let options = new RequestOptions({ headers });
return this.http.post('http://dogwelder.pocketgems.com/posts' , messageBody, options)
.map(this.extractData)
.catch(this.handleErrorObservable);
}