# 问题内容:

I’m trying to test Angular 5 httpClient PUT with jsonplaceholder but it’s giving me a 404.

Here is the code:

 putExample() {
return this.httpClient.put<any>('http://jsonplaceholder.typicode.com/posts', { title: 'sometitle' });
}


What I’m I doing wrong?

## 问题评论:

404 means not found – will say that the server does not know any PUT methods related to that endpoint

# 答案:

## 答案1:

JSONPlaceholder does not have a PUT method for http://jsonplaceholder.typicode.com/posts/ hence the 404 Not Found.

http://jsonplaceholder.typicode.com/

If you check the documentation again you’ll see that for PUT requests will work with http://jsonplaceholder.typicode.com/posts/:id where id is a number.

## 答案评论:

just like i said in the comment

## 原文地址：

https://stackoverflow.com/questions/47756118/angular-5-httpclient-using-put-jsonplaceholder-404

0