除了200之外,我如何在nestjs中发送错误代码?我尝试在方法中注入响应对象,但没有方法发送错误。
save(@Body() body: any, @Res() response: Response): string {
console.log("posting...")
console.log(body)
return "saving " + JSON.stringify(body)
}
Run Code Online (Sandbox Code Playgroud)
上面的代码发送带有 20X 状态的正文,我想发送不同的状态代码,例如 400 或 500。
我是新的android和rxjava.我已经通过很多例子来讨论使用rxbindings的事件.比如这个
RxView.clicks(b).subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
// do some work here
}
});
Run Code Online (Sandbox Code Playgroud)
要么
RxTextView.textChanges(name)
.subscribe(new Action1<String>() {
@Override
public void call(String value) {
// do some work with the updated text
}
});
Run Code Online (Sandbox Code Playgroud)
现在我想为android微调器做同样的事情.我想听itemselected事件.有人可以帮忙吗?
我知道java中的所有内容都是按值传递的,但下面的代码不应该打印2而不是1。
我所做的只是传递Integer
和改变它的价值。为什么打印 1 而不是 2 ?
public static Integer x;
public static void doChange(Integer x) {
x = 2;
}
public static void main(String arg[]) {
x = 1;
doChange(x);
System.out.println(x);
}
Run Code Online (Sandbox Code Playgroud) android ×1
java ×1
javascript ×1
nestjs ×1
rx-binding ×1
rx-java ×1
static ×1
typescript ×1
variables ×1