我有一个使用 Spring 构建的小型 Web 应用程序,并且可以从curl 和 postman 访问 REST 服务。如果我尝试使用 Web 应用程序上托管的 JavaScript 访问它们,则会收到 405 错误。什么可能导致这种情况?
我意识到代码中存在不安全性,这只是一个仓促的课程项目,所以它们并不重要。
如果我复制 JavaScript 代码并在浏览器的控制台中运行它,它就会起作用。用户等级
import org.springframework.data.annotation.Id;
public class User {
@Id
public String id;
private String username;
private String firstName;
private String lastName;
private String password;
private int zipCode;
private int jacketThreshold;
private int coatThreshold;
public User() {}
public User(String username)
{
this.username = username;
}
public User(String firstName, String lastName, String password) {
this.firstName = firstName;
this.lastName = lastName;
this.password = password;
}
public User(String username, String password, int zipCode) {
this.username = username;
this.password = password;
this.zipCode = zipCode;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getZipCode() {
return zipCode;
}
public void setZipCode(int zipCode) {
this.zipCode = zipCode;
}
public int getJacketThreshold() {
return jacketThreshold;
}
public void setJacketThreshold(int jacketThreshold) {
this.jacketThreshold = jacketThreshold;
}
aluckdog
森林海
繁花不似锦
相关分类